BookmarkSubscribeRSS Feed
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

I have the SAS code:

%Macro liblobname(lib,lob);

PROC SQL;

CREATE TABLE WORK.CLAIMS_&lob AS

SELECT distinct

t1.LOB,

t1.CLAIM_ID,

t1.MEMBER_ID,

t1.MEMBER_AGE,

t1.SERVICE_FROM_DATE,

t1.SERVICE_CATEGORY,

t1.Diag1,

t1.Diag2,

t1.Diag3,

t1.Diag4,

t1.Diag5,

t1.SERVICE_FROM_DATE,

T1.MEDICARE_INDICATOR

FROM &lib..FACETS_CLAIMS t1

WHERE t1.SERVICE_FROM_DATE >= '1Jun2016:0:0:0'dt

AND t1.SERVICE_FROM_DATE <= '31Jul2017:0:0:0'dt

AND T1.MEDICARE_INDICATOR='N';

QUIT;

%MEND liblobname;

%liblobname (KMHP0100,0100);

 

coudl not find what is wrong, no error message, but no result ....

could not resolve, please advise. thank you.

 

log:

_

49

1 ! ;*";*/;quit;run;

NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space

between a quoted string and the succeeding identifier is recommended.

 

 

8 REPLIES 8
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Not enough information to make any diagnosis here.  The log snippet indicates unbalanced quotes.  You could simplfy your code somewhat also to:

%macro liblonname (lib=,lob=);
  data claims_&lob. (keep=lob--medicare_indicator);
    set &lib..facets_claims;
    where '01JUN2017'd <= datepart(service_from_date) <= '31JUL2017'd
      and medicare_indicator="N";
  run;
%mend liblobname;

Although that whole code could be dropped in favour of putting all &lobs in one dataset and putting & lob as a column, then using by group processing which is both faster and easier to code.  Not entirely sure why the whole macro part is there at all, you create a table called lob but never filter on it?

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

ok, I will try .

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

run this.

%macro liblonname (lib=,lob=);

data claims_&lob, (keep=lob--medicare_indicator);

set &lib..facets_claims;

where '01JUN2017'd <= datepart(service_from_date) <= '31JUL2017'd

and medicare_indicator="N";

run;

%mend liblobname;

 

please see attach log file.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Thats not to do with my code.  You have/had unbalanced quotes at some point.  Start a new fresh session.

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

before it works, not sure what went wrong , dose not working any more....

 

I need %macro for this....

 

 

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

agree, I am starting a new sestion.

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

after start new session, it works.

 

Thank you

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 8 replies
  • 837 views
  • 0 likes
  • 3 in conversation