BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SAS_Novice22
Quartz | Level 8

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:

SAS_Novice22_0-1665151806958.png

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.

SAS_Novice22_1-1665152109424.png

Any assistance that you can provide to help me evaluate this sub-population would be greatly appreciated.

 

Thank you,

T. 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

View solution in original post

7 REPLIES 7
SAS_Novice22
Quartz | Level 8

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?

SAS_Novice22_0-1665153021872.png

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.

Quentin
Super User

What sort of descriptive analysis would you like to perform?  Maybe start with looking at PROC MEANS or PROC UNIVARIATE.

BASUG is hosting free webinars Next up: Don Henderson presenting on using hash functions (not hash tables!) to segment data on June 12. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
SAS_Novice22
Quartz | Level 8
Hi Quentin!
What would that code look like? How would I incorporate that code into my existing code. Also, how do I look at just the 2 missing values?
Thank you!
Tom
Super User Tom
Super User

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;
SAS_Novice22
Quartz | Level 8

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.

Tom
Super User Tom
Super User

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;
SAS_Novice22
Quartz | Level 8

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 7 replies
  • 671 views
  • 3 likes
  • 3 in conversation