BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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;
2 REPLIES 2
Andre
Obsidian | Level 7
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
deleted_user
Not applicable
Thanks! I appreciate your response!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 661 views
  • 0 likes
  • 2 in conversation