BookmarkSubscribeRSS Feed
laplanca
Calcite | Level 5

I made a data base combining the answers to 4 questionnaires for each ID. So I have 4 lines per subjid,
one for each questionnaire (different visit times). From the answers I created a new variable giving the
number of Cures for each person. Only to carry out my analyses I would need the value to appear on the 4
lines for each id. I don't know how to do this...

 

Here is my table for a better idea


Capture d’écran 2022-01-17 114819.png
Here is an idea of the result i need


Capture d’écran 2022-01-17 1819.png

2 REPLIES 2
PaigeMiller
Diamond | Level 26

UNTESTED CODE

proc sql;
    create table want as select *,max(nbcure) as max_nbcure from have
    group by subjid;
quit;

From now on, do not provide data as screen captures, we can't work with data that is in a screen capture. The way to provide data in the future, without exception, is as SAS data step code (instructions) and not in any other format.

--
Paige Miller
Ksharp
Super User

UNTESTED CODE

 

data want;
 merge have(drop=nbcure) 
       have(keep=subjid nbcure where=(nbcure is not missing));
 by subjid;
run;

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1215 views
  • 0 likes
  • 3 in conversation