SAS To Go
The blog entries I am making here are for my quick reference sake only. Anybody is free to view the content but use it at your own risk. As I mentioned earlier it is for my own reference. ThanQ! Thanks to "The Little SAS Book" by Lora D.Delwiche and Susan J.Slaughter. This book is a life saver for SAS programmers.
Saturday, January 28, 2017
Monday, January 16, 2017
Sunday, October 16, 2016
Saturday, October 8, 2016
Finding First and Last Observations
- In a drug dataset, records are available of patients taken drugs on different days.
- We want to find out what was the first visit of the patient and last visit of the patient and check his weight.
- Steps to find out first and last observations:
- Sort the drug dataset by patient isr.
- Use Set and By and find the first and last observations.
- The First and Last observations will be available as new columns with values 1 in the newly created dataset.
- Remember, You have to "use a BY statement, in conjunction with a SET statement, to identify the first and last observations among a group of observations".
Read more on this topic: https://onlinecourses.science.psu.edu/stat481/node/9
What is the benefit of specifying the OPTIONS?
You can enhance the appearance of your output by specifying SAS system options on the OPTIONS statement.
OPTIONS option(s);
NONUMBER - to suppress the output page numbers
NUMBER - to resume the output page numbers
PAGENO=5- resetting the next output page number
NOCENTER - removes center align if any and left aligns the output and output titles
CENTER - centers the output and output titles
PAGESIZE=40 - number of lines per page in the printed output
LINESIZE-120 - number of characters per line in the printed output
NODATE - removes the automatic date added by SAS in the top of the output
DATE - sets the automatic date that will be added by SAS
ORIENTATION=LANDSCAPE- prints the output in the horizontal mode
ORIENTATION=PORTRAIT - prints the output in the vertical mode
Read more:
https://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001782263.htm
OPTIONS option(s);
NONUMBER - to suppress the output page numbers
NUMBER - to resume the output page numbers
PAGENO=5- resetting the next output page number
NOCENTER - removes center align if any and left aligns the output and output titles
CENTER - centers the output and output titles
PAGESIZE=40 - number of lines per page in the printed output
LINESIZE-120 - number of characters per line in the printed output
NODATE - removes the automatic date added by SAS in the top of the output
DATE - sets the automatic date that will be added by SAS
ORIENTATION=LANDSCAPE- prints the output in the horizontal mode
ORIENTATION=PORTRAIT - prints the output in the vertical mode
Read more:
https://support.sas.com/documentation/cdl/en/basess/58133/HTML/default/viewer.htm#a001782263.htm
Saturday, October 1, 2016
Auto Macro Variables
Every time you invoke SAS, the macro processor automatically creates certain macro variables. You can use these variables in your programs. The most common automatic macro variables are &SYSDATE, &SYSDAY, etc.
Subscribe to:
Posts (Atom)