BookmarkSubscribeRSS Feed
ColeG
Obsidian | Level 7

I am creating a retention report to show the number of participants retained in research procedures month over month. In this report there are rows for each site and columns for each month. Within each row is a "sub row" for "Total Enrolled," "N expected," (people we expect back within each time period; changes since not everyone is enrolled in the same month) "N retained," (number who came back for their expected procedures) and "% retained."

 

Since "Total Enrolled" is not time-dependent, it would be cleaner to have enrolled as a stand-alone column (one more column total, one fewer row per site) but when I try to add it to the columns dimension much as I would with the ALL option I get the error "There are multiple analysis variables associated with a single table cell in the following nesting: site*f*____*enrolled*sum*s" where "_____" is  expected, retainedN, or retainedPCT (three total errors).

 

I cannot use the ALL option since the N expected will not add up to the total N enrolled (e.g., early censoring).

 

Hopefully this pastes, I'm trying to do something like this:

  N enrolledTime 1Time 2
Site 1Sub Denom1009267
 Sub Num 8660
 % 93.5%89.6%
Site 2Sub Denom15010474
 Sub Num 8455
 % 80.8%74.3%
TotalSub Denom250196141
 Sub Num 170115
 % 86.7%81.6%

 

Thanks for your help!

2 REPLIES 2
ballardw
Super User

If you don't want to nest variable then just place them together. If you want the same statistics for each group with parentheses.

 

Some example data so we have variable names and types would help. At least show your  current code.

 

Is "Total enrolled" supposed to equal the number records? The likely you just need N without a variable BUT you will likely get it repeated as it crosses with each row.

proc tabulate data=sashelp.class;
   class sex;
   var height weight;
   table sex,
         n='Number of obs' height*mean weight*max
         /
   ;
run;

or provide example data:

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

ColeG
Obsidian | Level 7

Hi thank you for your reply.

 

I'm not sure what you mean by "If you don't want to nest variable then just place them together. If you want the same statistics for each group with parentheses."

 

Your suggestion is close to what I'm looking for but I am creating this from a summary table rather than an observation level one.

 

My data looks something like this, albeit with more rows:

data retainreport;
 infile datalines delimiter=',';
 input site visitcode enrolled expected retained retainedpct;
 datalines;
1,1,50,40,30,.75
1,2,50,30,20,.67
1,3,50,20,10,.5
1,4,50,10,0,0
 ;
run;
proc tabulate data=retainreport; class site visitcode / order=data; classlev site; classlev visitcode; var enrolled expected retained retainedpct; table (site='')* (enrolled*f=best12. expected*f=best12. retained*f=best12. retainedpct*f=percent6.), visitcode*(sum=''); run;

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!

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
  • 2262 views
  • 0 likes
  • 2 in conversation