78 data work.flights;
79 destination = 'CPH';
81 when('LHR') city = 'London';
82 when('CPH') city = 'Copenhagen';
NOTE: The data set WORK.FLIGHTS has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
The statement destination = 'CPH'; assigns a value of 'CPH' for the variable destination. The variable city first appears in the statement when('LHR') city = 'London'; where the SAS compiler sets a length of 6 for this city variable (based on the length of the 'London' string). The length of this variable cannot be changed later on in the program unless specified explicitly using a LENGTH statement as the first statement in the data step. For the statement when('CPH') city = 'Copenhagen'; the data is truncated for variable city and is assigned the value 'Copenh'. Since condition on this line is evaluated to be true, SAS writes the output in the dataset WORK.FLIGHTS.
The one and only FREE resource for general SAS online training as well as study guides for the SAS Base Certification. My goal is to create the SAS Certification prep guide that I never found but always wanted. This should also be a place to come if you are new to the language but are simply looking for online SAS training.