DATA Step, Macro, Functions and more

macro varibles

Reply
Frequent Contributor
Frequent Contributor
Posts: 98

macro varibles

%macro LOBNoCode(lobname1,lobname2);

PROC TRANSPOSE DATA=Paid_Claims_Final&lobname1 OUT=Paid_Claims_Final&lobname1TRANS (DROP=_NAME_);

ID MONTH;

BY LOB Category Code CODE_DESCRIPTION;

RUN;

%mend LOBNoCode;

%lobnocode(0100,'0100');

 

Got the error:

ERROR 22-322: Syntax error, expecting one of the following: ;, (, DATA, DELIM, DELIMITER, INDB, LABEL, LET, NAME, OUT, PREFIX,

SUFFIX.

 

Do no tknow why

Frequent Contributor
Frequent Contributor
Posts: 98

Re: macro varibles

table PAID_CLAIMS_FINAL0100  exisiting , no problem

 

Trusted Advisor
Posts: 1,934

Re: macro varibles


JHE wrote:

%macro LOBNoCode(lobname1,lobname2);

PROC TRANSPOSE DATA=Paid_Claims_Final&lobname1 OUT=Paid_Claims_Final&lobname1TRANS (DROP=_NAME_);

ID MONTH;

BY LOB Category Code CODE_DESCRIPTION;

RUN;

%mend LOBNoCode;

%lobnocode(0100,'0100');

 

Got the error:

ERROR 22-322: Syntax error, expecting one of the following: ;, (, DATA, DELIM, DELIMITER, INDB, LABEL, LET, NAME, OUT, PREFIX,

SUFFIX.

 

Do no tknow why


It's always helpful to show us the entire SASLOG (or the relevant parts related to this PROC) and not just the ERROR message.

 

As a guess, what happens if you use this, where &lobname1 in the OUT= is followed by a period

 

PROC TRANSPOSE DATA=Paid_Claims_Final&lobname1 OUT=Paid_Claims_Final&lobname1.TRANS (DROP=_NAME_);
Frequent Contributor
Frequent Contributor
Posts: 98

Re: macro varibles

Posted in reply to PaigeMiller

attached

Super User
Posts: 11,343

Re: macro varibles

It is best to post code and log results into a code box using the forum {i} icon.

 

Many folks don't want to open Excel or Word documents because of security or corporate policy not allowing the download.

Frequent Contributor
Frequent Contributor
Posts: 98

Re: macro varibles

ok, will do . Thank you remind me.

Super User
Posts: 5,518

Re: macro varibles

On your OUT= designation, SAS doesn't know what the name of the macro variable is.  Using lower/upper case isn't enough:

 

OUT=Paid_Claims_Final&lobname1TRANS

 

Instead, you have to tell SAS specifically where the name of the macro variable ends by adding a dot:

 

OUT=Paid_Claims_Final&lobname1.TRANS

Frequent Contributor
Frequent Contributor
Posts: 98

Re: macro varibles

Posted in reply to Astounding

This code works. Smiley Very HappySmiley Very Happy

 

Thank you

 

%macro LOBNoCode(lobname1,lobname2);

PROC TRANSPOSE DATA=Paid_Claims_Final&lobname1 OUT=Paid_Claims_Final&lobname1.TRANS (DROP=_NAME_);

ID MONTH;

BY LOB Category Code CODE_DESCRIPTION;

RUN;

%mend LOBNoCode;

%lobnocode(0100,'0100');

Ask a Question
Discussion stats
  • 7 replies
  • 147 views
  • 0 likes
  • 4 in conversation