- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
-
writes the current output line to the current location, even if the current output line is blank
-
releases an output line that is being held with a trailing @ by a previous PUT statement.
Details
Comparisons
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
@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.