1---+----10---+----20---+--- FRANCE,INDIA,10MAR2004 ITALY,USA,10/20/2004 SAFRICA,FRANCE,17JUN2004 AMERICA,FRANCE,12/31/2004 FRANCE,USA,20JAN2004 ITALY,USA,08/19/2004
The following SAS program is submitted using this file as input:
1 2 3 4 5 6 7 8 | data work.flights; infile 'file-specification' dsd; input from_co $ @; if from_co='FRANCE' or from_co='SAFRICA' then do; input to_country $ flightdate : date9.; output; end; run; |
How many observations does the Work.Flights data set contain? I don,t understant because is 3
The trick to understanding code is to comment each line.
Ones you don't understand will stand out.
Is there a specific piece of the code you're not understanding?
When there are explicit OUTPUT statements data is only written to the data set when the Output is executed. The Output in the example is only executed when the condition :
if from_co='FRANCE' or from_co='SAFRICA'
is true.
So when the from country is FRANCE or SAFRICA is the only time you get results.
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.