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

 

when i am running this code this is showing an error into the log ,so what wrong I am doing there.

 

%macro attrib(domain=);
%if &domain = DM %then %do;
attrib
STUDYID length = $15 label = "Study Identifier"
DOMAIN length = $2 label = "Domain Abbreviation"
USUBJID length = $25 label = "Unique Subject Identifier"
SUBJID length = $7 label = "Subject Identifier for the Study"
RFSTDTC length = $10 label = "Subject Reference Start Date"
RFENDTC length = $10 label = "Subject Reference End Date/Time"
RFXSTDTC length = $10 label = "Date/Time of First Study Treatment"
RFXENDTC length = $10 label = "Date/Time of Last Study Treatment"
RFICDTC length = $10 label = "Date/Time of Informed Consent"
RFPENDTC length = $10 label = "Date/Time of End of Participation"
DTHDTC length = $10 label = "Date/Time of Death"
DTHFL length = $2 label = "Subject Death Flag"
SITEID length = $7 label = "Study Site Identifier"
BRTHDTC length = $10 label = " Date/Time of Birth"
AGE length = $8. label = "Age"
AGEU length = $5 label = "Age Units"
SEX length = $2 label = "Sex"
RACE length = $40 label = "Race"
ARMCD length = $8 label = "Planned Arm Code"
ARM length = $40 label = "Description of Planned Arm"
ACTARMCD length = $8 label = "Actual Arm Code"
ACTARM length = $40 label = "Description of Actual Arm Code"
COUNTRY length = $3 label = "Country";
%end;
%mend;
%attrib(domain=DM);

 

/**************************************************/

This is the error -

69 %attrib(domain=DM);
NOTE: Line generated by the invoked macro "ATTRIB".
69 attrib STUDYID length = $15 label = "Study Identifier" DOMAIN length = $2 label = "Domain Abbreviation" USUBJID length = $25 label = "Unique Subject Identifier" SUBJID length = $17 label = "Subject Identifier for the Study" RFSTDTC length =
______
180
69 ! $10 label =
 
ERROR 180-322: Statement is not valid or it is used out of proper order.
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

You cannot run an ATTRIB statement in the middle of nowhere.  It has to be part of a DATA step.

What dataset are you trying to create?  Let's say you want to make a dataset named WANT.

data want;
  %attrib(domain=DM);
  stop;
  call missing(of _all_);
run;

 

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

You cannot run an ATTRIB statement in the middle of nowhere.  It has to be part of a DATA step.

What dataset are you trying to create?  Let's say you want to make a dataset named WANT.

data want;
  %attrib(domain=DM);
  stop;
  call missing(of _all_);
run;

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 502 views
  • 0 likes
  • 2 in conversation