Module 11: Creating Output with ODS and Exporting Data From SAS Flashcards

1
Q

What are the 3 main methods of exporting data from SAS programaically?

A

1) Using ODS
2) In a PROC EXPORT step
3) In a DATA step, using PUT statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Write the general syntax for PROC EXPORT.

A

proc export data=dataset;
outfile = file-path\file-name.file-type
dbms = deliminator-type
replace;
run;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In PROC EXPORT, how do you specify the file extension?

A

Put the file extension that you want to use in the file name.
Ex. file-path*file-name*.csv

This example specifics a csv is to be explorted

Can also do xlsx, dta, txt, etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In PROC EXPORT, what does the dbms satement do?

A

Specifies the type of delimiter to use.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

T/F: Using the dbms option takes precedence over the file extension when exporting data.

A

True: Will override the delimiter type normally used in the file extension.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

T/F: Formats are not exported for delimited files in PROC EXPORT.

A

False: Formats are exported

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Explain the lines in the following code.

1) data -null-;
2) set one;
3) file ‘file-path-and-extension’;
4) if -n-=1 then put @01 “EMPID” @10 “GENDER” @20 “RACE;
5) put @01 empid @10 gender @20 race;
run;

Note: - = underscore

This is for tab delimited files

A

1)Creates an automatic null dataset and is used so no additional datasets are created, only external file
2)Using data from one
3)Creates new file
4)Puts headers for data
5)Creating variable columns starting at line 1, 10, and 20

Note: make sure columns are ‘wide’ enough for header and data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Explain the lines in the following code.

1) data -null-; set one;
2) file ‘file-path-and-extension’ dlm = ‘,’;
3) if -n- = 1 then put ‘EMPID’ ‘,’ ‘GENDER’ ‘,’ ‘RACE’ ‘,’;
4) put empid gender race;
run;

Note: - = underscore

This is for comma delimited files

A

1)Creates automatic null dataset using data from one
2)Creates new file
3)Specifies row 1 as header row, seperated variables by commas
4)specifies the order of data for columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

T/F: HTML is the default destination for SAS Studio, the SAS windowing environment, and UNIX.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why do we use the ODS TRACE statement?

A

Helps us find the names of output obejects that can then be used as regular SAS datasets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you turn ODS TRACE on and off?

A

ods trace on;
ods trace off;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write the general code to specify the datasets you want SAS to create in ODS.

A

ods output output-object = dataset-name;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Where do you put the ODS OUTPUT statement in SAS?

A

Ex. proc glm data=one;
by flsa;
class eeogroup;
model = specified-model;
ods output output-object = dataset;
run;

After proc statement, but before next run, proc , or data statement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Explain the lines in the following code.

1) ods csv file= ‘file-path\filename.csv’;
2) proc print data=allresults noobs;
3) title1 ‘model output’;
run;
4) ods csv close;

A

1) creates exporting path and filename, specifying its a csv
2) specifies what to put in new file, excluding observation numbers
3) Creates a title for file
4) closes csv file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

T/F: ODS output is created in the windowing mode.

A

False: Writes in an output window

How well did you know this?
1
Not at all
2
3
4
5
Perfectly