Pages

Showing posts with label slider. Show all posts
Showing posts with label slider. Show all posts

Thursday, March 6, 2014

How to create a PDF file of a SAS job


For creating a PDF file of a SAS job or SAS procedure, we need to bracket the section of code for which you want to create tables or/and graphs:

options orientation=landscape;
ods pdf file=’test.pdf’;
goptions device=pdf colors=(black) rotate=landscape;
...
\SAS\ procedures
...
ods pdf close;

Example:

options orientation=landscape;
ods pdf file=’output-to-Test.pdf’;
goptions device=pdf colors=(black) rotate=landscape;

ods graphics on;

Tuesday, February 25, 2014

How to retrieve the first character of a variable in SAS

If you need to create a variable which has only first character of the character variable, then there are 4 different ways with which you can do the same in SAS. Below each variable B1,B2,B3 and B4 contains Letter A, but the length is not the same for all the four variables.


data test;
 name='Alpha';
 B1 = substr(name,1,1);
 B2 = first(name);
 substr(B3,1,1) = name;
 length B4 $1;
 B4 = name; 
run;

Read data directly from websites in SAS

Do you know you can read data from websites directly? You can use the URL Access Method in the filename statement in SAS.

filename seercode URL "http://www.abc/data.txt";
data siterecode;
infile seercode truncover;
input @1 bigline $char256.;
run;

How to clear library of data in SAS

At times there is a need to clear the permanent library of datasets at one go. There is an option in SAS, PROC DATASETS provides a solution on the proc statement with a Kill Option.

Here is an example:

PROC DATASETS LIBRARY = TEMP KILL;
RUN;