BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bharath86
Obsidian | Level 7

Hi 

 

Below is the code and a note from the log file while executing this code.

Why does SAS think first.usubjid is a varible by itself. 

Please advise how to get rid of this note from the log file or an alternate to this code. 

230        data mh_fin;
231        set mh mh_test4;
232        
233        	if first.usubjid then MHSEQ=1;
234        	else MHSEQ+1;
235        
236        run;


NOTE: Variable first.usubjid is uninitialized.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi @bharath86,

 

Have you tried using a by statement with the variable usubjid after the set statement?

 

Kind regards,

Amir.

View solution in original post

2 REPLIES 2
Amir
PROC Star

Hi @bharath86,

 

Have you tried using a by statement with the variable usubjid after the set statement?

 

Kind regards,

Amir.

bharath86
Obsidian | Level 7

Hey, 

 

Thanks for raising that by statement.

 

I actually revised the code and changed the variable.

 

data mh_fin;
set mh mh_test4;
by studyid;
	if first.studyid then MHSEQ=1;
	else MHSEQ+1;

run;

Thank you that helps.

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
  • 1020 views
  • 1 like
  • 2 in conversation