Hello,
I have a dataset that includes all participants who have consented, reconsented and completed the study. I would like to look at only those subjects who reconsented and conduct some basic descriptive analysis on the sub-group.
Can I ask for assistance as to what the code would look like in order for me to do this?
Here is what my dataset looks like:
I only want to look at all participants who have information in the RICAYN_DEC column and conduct some basic descriptive analysis including missing data etc.
311 /* creating a seperate dataset - Re-consent Overall*/ 312 PROC FREQ DATA=WORK.DS2; 313 TABLE RICAYN_DEC / OUT= RICAYN_DEC; 314 RUN;
The code above that I tried does not work. But this is not what I want. Because the missing is not accurately reflecting the missing for only the RICAYN_DEC sub-set. I am would like to look at this information in different ways.
Any assistance that you can provide to help me evaluate this sub-population would be greatly appreciated.
Thank you,
T.
Not sure what you are talking about. Are you looking to find the two observations with missing values identified by this code?
PROC FREQ DATA=DS2;
where PAGENAME="Re-consent";
table RICAYN_DEC;
RUN;
Then you need to include the test of the PAGENAME variable also.
PROC print DATA=DS2;
where PAGENAME="Re-consent" and missing(RICAYN_DEC);
RUN;
Follow-up email:
PROC FREQ DATA=DS2; where PAGENAME="Re-consent"; table RICAYN_DEC; RUN;
I figured out how to look at just this sub-set but how do I perform additional descriptive analyses?
How would I look at just those missing ones? The code below does not work:
TITLE "Missing Re-consent?"; PROC PRINT DATA=WORK.DS2; VAR SUBNUM; WHERE RICAYN_DEC=.; RUN;
Thank you,
T.
What sort of descriptive analysis would you like to perform? Maybe start with looking at PROC MEANS or PROC UNIVARIATE.
Is that RICAYN_DEC variable numeric? That is what your WHERE statement is assuming.
I would assume the variable is character given the other outputs you showed. The only way the values could print as YES and NO if it was numeric would be because it had a format attached to the variable that displayed those strings.
Try using the MISSING() function as that will work for both numeric and character variables.
PROC PRINT DATA=WORK.DS2;
VAR SUBNUM;
WHERE missing(RICAYN_DEC);
RUN;
Hi @Tom
Thank for your help, unfortunately that did not work. Its providing all missing in that column as opposed to the 2 missing values in the subset.
Any other ideas?
414 TITLE "Missing Re-consent?"; 415 PROC PRINT DATA=WORK.DS2; 416 VAR SUBNUM; 417 WHERE missing(RICAYN_DEC); 418 RUN; NOTE: There were 338 observations read from the data set WORK.DS2. WHERE MISSING(RICAYN_DEC); NOTE: PROCEDURE PRINT used (Total process time): real time 0.04 seconds cpu time 0.06 seconds
Thanks!
T.
Not sure what you are talking about. Are you looking to find the two observations with missing values identified by this code?
PROC FREQ DATA=DS2;
where PAGENAME="Re-consent";
table RICAYN_DEC;
RUN;
Then you need to include the test of the PAGENAME variable also.
PROC print DATA=DS2;
where PAGENAME="Re-consent" and missing(RICAYN_DEC);
RUN;
Hi Tom,
Thank you!
TITLE "Missing Re-consent? VARIABLE"; PROC PRINT DATA=WORK.DS2; VAR SUBNUM; WHERE missing(RICAYN_DEC) AND PAGENAME="Re-consent"; RUN;
This is exactly correct.
Best,
T.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.