Help using Base SAS procedures

set to two datasets?

Reply
N/A
Posts: 0

set to two datasets?

Can anyone explain what the following code does?It is just before a proc surveymeans. The data set has ca.type has type=1, type=2, type=3. I inherited the program and don't understand it:

data ca.type;
set cak;
type ' '0';
run;
data ca.type;
set ca.type cak;
run;
proc sort data = ca.type;
by type;
run;
Super Contributor
Posts: 273

Re: set to two datasets?

Posted in reply to deleted_user
First you make a mistake in copying the code your first type is in that case: type ='0';
if not go to third!


Second
you have a first datastep creating a sas dataset with the name type
written in the library defined behind the libref ca
In that data step, you are reading temporary sas dataset cak and adding to every
observations a new variable numeric type with value 0
with a second datastep you are taking the preceeding table issued from the datastep
and adding once again cak dataset.
as the structure is the same for both dataset except that you don't have the type variable
in cak, type will take as value the . as missing value
in the third step you are sorting the final ca.type dataset upon the value of type

Third Now a personnal remark :
If you are saying that type as already values like 1 2 3
I too don't understand nothing

so my final suggestion
work step by step
and after every step take a look at your output table with VT command
to understand what's happening to type!

And read your log especially after the first step submit.

Andre

HTH
Andre
N/A
Posts: 0

Re: set to two datasets?

Thanks! I appreciate your response!
Ask a Question
Discussion stats
  • 2 replies
  • 127 views
  • 0 likes
  • 2 in conversation