- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Need help !
I am getting error while running query and %put is not printing the values.
I am building some counts and loading into Oracle tables' numeric fields.
PROC SQL noprint;
Create Table output_Stats as
Select count(distinct(CLMS)),
count(CLMS),
count(distinct(MBRS)),
count(distinct(PROVS)),
sum(DOLLARS)
into
:&run_type._CLM_COUNT,
:&run_type._CLMS_COUNT,
:&run_type._MEM_COUNT,
:&run_type._PROV_COUNT,
:&run_type._DOLLARS
from output_x;
Quit;
%put &=&&run_type._CLM_COUNT &=&&run_type._CLMS_COUNT &=&&run_type._MEM_COUNT &=&&run_type._PROV _COUNT &=&&run_type._DOLLARS;
/* Note: Oracle table fields are numeric attributes */
%If &run_type = R %then
%do;
proc sql noprint;
update <Oracle_table>
set CLM_CNT = INPUT(&&run_type._CLM_COUNT.,4.) , /* i tried loading direct, but it was telling char error */
CLMS_CNT = INPUT(&&run_type._CLM_LINE_COUNT.,4.) ,
MEM_CNT = INPUT(&&run_type._MEMBER_COUNT.,4.) ,
PROV_CNT = INPUT(&&run_type._PROVIDER_COUNT.,4.)
where <condition>
;
Quit;
%end;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried using 3 ampersands ('&&&') for example:
CLMS_CNT = INPUT(&&&run_type._CLM_LINE_COUNT.,4.)
As you want run_type to resolve first then the whole macro variable needs to be resolved.
Amir.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
What error do you get?
Please show us the entire LOG file for this code (not just the error messages) by clicking on the {i} icon, and then pasting the log into the window that appears. Do not paste the log directly into your reply, use the {i} icon.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
1) %put is not printing the numbers.
2) log of error -
30303 proc sql noprint; update <table> set
CLM_CNT =
30303 ! INPUT(&&run_type._CLM_COUNT.,4.) ,
CLMS_CNT = INPUT(&&run_type._CLM_LINE_COUNT.,4.) ,
_
22
30303 ! MEMBER_CNT
ERROR 22-322: Syntax error, expecting one of the following: a name, *.
SYMBOLGEN: && resolves to &.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
&&RUN_TYPE is never set to a value.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
MLOGIC(code): %IF condition &run_type = R is TRUE
run_type is resolving correctly.I pasted log.
put statements are coming as below, actual values are not printing
&=R_CLM_COUNT &=R_CLMS_COUNT &=R_MEM_COUNT &=R_PROV_COUNT &=R_DOLLARS
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you show us the entire log, not just the area of the code where the error appears?
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried using 3 ampersands ('&&&') for example:
CLMS_CNT = INPUT(&&&run_type._CLM_LINE_COUNT.,4.)
As you want run_type to resolve first then the whole macro variable needs to be resolved.
Amir.