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 -
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;
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;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.