BookmarkSubscribeRSS Feed
RShaw
Calcite | Level 5

Helllo! I am a research student that is working with survey data to examine the co-occurrence of itch with other co-morbidities. Basically, I am looking at whether or not itch presents with other comorbidities such as PulmonaryCardiac pre- and post-survey. The following code, for example, I think, was used to delineate that: 

 

if(Pre_PulmonaryCardiac = 0 & Post_PulmonaryCardiac = 1) then PulmonaryCardiac = 1;
else if(Pre_PulmonaryCardiac = 1 & Post_PulmonaryCardiac = 0) then PulmonaryCardiac = 2;
else if(Pre_PulmonaryCardiac = 1 & Post_PulmonaryCardiac = 1) then PulmonaryCardiac = 3;
else PulmonaryCardiac = 0; 

 

I'm now trying to create a combined frequency table of results to examine whether itch presented with PulmonaryCardiac regardless of whether its pre- or post-survey. In other words, I want to develop a format that combines any patients that have any instance of a particular variable and set that to 1, if no then 0.

 

The code I am currently utilizing does not give me the right combined results: 

 

proc freq data = ITCH.CROSS_MERGED1;
where PulmonaryCardiac = 0 | PulmonaryCardiac = 2;
tables rMSA_Q_12 * PulmonaryCardiac / chisq;
format PulmonaryCardiac FORMAT_FOR_COMPOSITES. rMSA_Q_12 rMSA_2bin.;

 

Wrong Combines Results.png

 

How should I format a code that would allow me to get frequencies for: (1) no Dx pre and post (2) Dx pre, post, whereever?

 

2 REPLIES 2
Reeza
Super User
Can you post an example of what your input data looks like and what you would expect as output.
s_lassen
Meteorite | Level 14

Not sure if that's what you want, but a format to divide the data into any/no pulmonary condition can be written like this:

proc format;
  value anyPulmonary
    0='No pulmonary condition'
    1,2,3='Pulmonary condition'
    ;
run;

You can than apply that format to your PulmonaryCardiac variable.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 732 views
  • 2 likes
  • 3 in conversation