Given the SAS data set PERM.STUDENTS: PERM.STUDENTS NAME AGE --------- ------- Alfred 14 Alice 13 Barbara 13 Carol 14 The following SAS program is submitted: libname perm ‘SAS data library’; data students; set perm.students; file ‘file specification’; put name $ age; <insert statement here> run; The following double-spaced file is desired as output Alfred 14 Alice 13 Barbara 13 Carol 14 Which statement completes the program and creates the desired file?
A. put _null_; B. put; C. double; D. put/;So, the answer is B. put; But I don't get why. I mean you already have a put statement right above. Plus, as far as I understand "put" is meant to be used for changing a numeric variable to a character variable. What would a "put" do on it's own?
As is, the program writes the desired report, writing each line of data to a separate line. The requirements were actually a little bit different, however, to get a double-spaced report. So you need to make a change that will write out a blank line as well. That's why B is needed.
It's worth learning to navigate the documentation, it has almost all the answers.
In this case you're mixing up a STATEMENT vs a FUNCTION, both with the same name. The comparison section of the PUT statement also details this explicitly.
It mayalso be worth looking up SUM(), since it's another one, with both a function and statement and they behave differently as well.
Just to be more confusing the there are actually two SUM() functions.
There is the SQL aggregate function SUM() that takes one argument and produces the sum across rows.
There is data step function SUM() that takes two or more arguments and produces the sum of its arguments, which could be thought of as producing the sum across columns instead of rows.
As is, the program writes the desired report, writing each line of data to a separate line. The requirements were actually a little bit different, however, to get a double-spaced report. So you need to make a change that will write out a blank line as well. That's why B is needed.
@preetimangtani wrote:
If you visit this site: http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n1h2bc0rkcufgwn11accg...It says,Print the data set EXPREV. EXPREV contains information about a company's product order type and price per unit for two months. DOUBLE inserts a blank line between observations. The DOUBLE option has no effect on the HTML output.proc print data = exprev double;Does this not mean that the answer should actually be double and not put?
The DOUBLE keyword in the article you linked to is an option on the PROC PRINT statement and not a stand alone statement like in the choices listed in the original problem.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.