14.03.2014 Views

Scripting Guide - SAS

Scripting Guide - SAS

Scripting Guide - SAS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7 Data Structures 171<br />

Associative Arrays<br />

Examples<br />

The following examples illustrate Insert() and Insert Into():<br />

newcary = Insert(cary, "time zone", "Eastern");<br />

show(cary, newcary);<br />

cary = Associative Array({<br />

{"high schools",{"Cary", "Green Hope", "Panther Creek"}},<br />

{"population", 116244},<br />

{"state", "NC"},<br />

{"weather", "sunny"}<br />

});<br />

newcary = Associative Array({<br />

{"high schools", {"Cary", "Green Hope", "Panther Creek"}},<br />

{"population", 116244},<br />

{"state", "NC"},<br />

{"time zone", "Eastern"},<br />

{"weather", "sunny"}<br />

});<br />

Insert Into(cary, "county", "Wake");<br />

show(cary);<br />

cary = Associative Array({<br />

{"county", "Wake"},<br />

{"high schools", {"Cary", "Green Hope", "Panther Creek"}},<br />

{"population", 116244},<br />

{"state", "NC"},<br />

{"weather", "sunny"}<br />

});<br />

Note that aa 116244, "state" => "NC",<br />

"weather" => "sunny"];<br />

Remove From(cary, "weather");<br />

show(cary);<br />

cary = Associative Array({<br />

{"county", "Wake"},<br />

{"high schools", {"Cary", "Green Hope", "Panther Creek"}},<br />

{"population", 116244},

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!