SAS Notes
Compiled by : Wilson Suraweera @ CGHR
- Contents
- Random Numbers in SAS
- Data Sub-setting
- Method for Select a Random Sample
- Missing values replacement with Means of the
respective Variables
- Logistic Regression with SAS
- SAS made
easy using Proc SQL
- SAS PROC SQL procedure to access external ODBC
data sources
- SAS String Data Handling
- External Resources
-
Macro Seminar
- UCLA
- Logistic regression
-
Some Interesting SAS SQL Examples
- SAS Dinosaur - Old and New way
of SAS progrming
- Paul Dicman's Web Page for SAS- This little old discusses SAS 8, but useful
- Global Statements Dictionary - Alphabatical listing and Description of SAS Key words
-
Selection of 2 random samples from a dataset
data
Sample1 sample2;
j=1;
n1=0;
n2=0;
/* n1, n2 are smaple sizes Suppose we want to have 2 male and female samples of
100 each*/
do
while
((n1+n2)<
200);
Slice=int(69514*ranuni(-1));
/* This is # of observations in your data set */
set
mydataset point=Slice;
/* u have to replace mydataset with one of your existing dataset here*/
if
gender=1
and n1<=100)
then
do;
output
sample1;
n1=n1+1;
end;
else
if
(n2<=100)
then
do;
output
sample2;
n2=n2+1;
end;
end;
stop;
drop
j n1 n2;
run;