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

I have a SAS coding issue which I am hoping someone can assist with.

 

My job is using the following instruction to create a SAS macro variable called &init_valueAMPEPCNT : -

 

proc sql;

select TOTAL_CR_CNT into :init_valueAMPEPCNT from perm.recordsAMPEP3;

where file_id = 'EFTAMPNZ';

quit;

 

Problem is, the job returns a condition code of RC=4.

 

This is what is returned: -

 

149 proc sql;

150 select TOTAL_CR_CNT into :init_valueAMPEPCNT from perm.recordsAMPEP3;

151 where file_id = 'EFTAMPNZ';

WARNING: This SAS global statement is not supported in PROC SQL. It has been ignored.

152 quit;

 

I am wanting a clean run of RC=0.

 

Referring to documentation on the internet I think our version of SQL may not support this representation (with the colon  :🙂 to signify a macro variable).

 

I'm wondering if there is an alternative way of coding this short of not using SQL at all and going with SAS code only.

1 ACCEPTED SOLUTION

Accepted Solutions
clmeyer
Calcite | Level 5

Removed the semi-colon and it worked!!! Thanks very much for a quick response. 

View solution in original post

4 REPLIES 4
PGStats
Opal | Level 21

remove the semicolon before the where clause.

PG
novinosrin
Tourmaline | Level 20

Oops sorry sir @PGStats  for the duplication. I didn;t see your post. 

novinosrin
Tourmaline | Level 20

Are you sure whether your proc sql syntax is correct, i see one error

 

select TOTAL_CR_CNT into :init_valueAMPEPCNT from perm.recordsAMPEP3;  /*shouldn't be semicolon here*/

 

The syntax should ideally be

 



proc sql;

select TOTAL_CR_CNT into :init_valueAMPEPCNT from perm.recordsAMPEP3

where file_id = 'EFTAMPNZ';

quit;
clmeyer
Calcite | Level 5

Removed the semi-colon and it worked!!! Thanks very much for a quick response. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 4 replies
  • 10742 views
  • 1 like
  • 3 in conversation