Hello there,
I recently restarted up my MPH after a long hiatus, and my SAS brain has completely atrophied! I am working on what should be a very easy procedure, however, I can't seem to get the syntax right.
I have four categories of tobacco consumption, coded 1 2 3 and 4. I want to have 2 categories, low and high, with the first two (1 and 2) being low and the second 2 (3 and 4) being high. I need to do this to calculate measures of association between use and obesity. I was able to do this easily with the two category variable of case or control.
Are you by chance asking how to write the syntax for proc format?
I think so? again, this is all very new (again) to me.
hmm
is this what you are asking
proc format;
value frmt 1,2 = 'Low'
3,4 = 'High';
run;
data test;
do i=1 to 4;
output;
end;
format i frmt.;
run;
or
want=put(i,frmt.);
data test;
do i=1 to 4;
want=put(i,frmt.);
output;
end;
run;
I will get back to you tomorrow morning when I am back at it...thank you so much for your help!
I'm actually not worried about the format, but the observations. I want them grouped by level of tobacco use. I have four categories now, and I want two, high and low.
This below yields the tables and statistics I want but with four categories of tobacco use instead of 2, because that is how they are organized.
proc print data = work.hw2;
run;
proc freq data = hw2;
tables Tob * Case/ measures;
title;
run;
Without knowing the data, it's very difficult to imagine. It would help if you could post a sample of your data(a few records) alongside explaining your requirement i.e what you want to accomplish based on the sample. An output sample would make it convenient
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.