I tried many ways and I cannot get this warning message away. What did I do wrong?
PROC SQL;
CREATE TABLE QUERY_FOR_PROCESS_REQUEST AS
SELECT t2.ID_PRODT,
t1.Price,
t1.coupon,
t1.PriceAsofDateTime
FROM process_request t1
INNER JOIN arm_mapping t2 ON (t1.BenchmarkSecurityProduct = t2.New_PMA_Service);
QUIT;
proc print data=QUERY_FOR_PROCESS_REQUEST;
run;
data prices(rename=(Price=RATE_PRCE_TBA Coupon=pct_cpn PriceAsofDateTime=DT_MKT)
keep=ID_PRODT PRCE_TBA pct_cpn DT_MKT);
set QUERY_FOR_PROCESS_REQUEST;
run;
proc print data=pms_arm_prices;
run;
WARNING: The variable Price in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable Coupon in the DROP, KEEP, or RENAME list has never been referenced.
WARNING: The variable PriceAsofDateTime in the DROP, KEEP, or RENAME list has never been referenced.
NOTE: There were 574 observations read from the data set QUERY_FOR_PROCESS_REQUEST.
NOTE: The data set PMS_ARM_PRICES has 574 observations and 1 variables.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.01 seconds
FYI: Anytime that have a Rename and Drop/Keep list in the same data set options the Drop/Keep list has to use the "old" name.
If had done the Rename on the SET statement the Keep would work as written. A matter of timing.
I was going to ask why you didn't just rename in the Proc SQL and completely avoid that data step.
And since you were using a data set created with only those variables to begin with I was questioning why a KEEP at all???
Please show us the log, intact, with nothing chopped out, so we can see where these WARNINGs appear.
When you copy the log, copy it as text, and paste it into the window that opens when you click on the </> icon. DO NOT SKIP THIS STEP.
Thank you. I figured out the solution. I rename the columns inside PROC SQL. I don't need to do extra steps in dataset.
FYI: Anytime that have a Rename and Drop/Keep list in the same data set options the Drop/Keep list has to use the "old" name.
If had done the Rename on the SET statement the Keep would work as written. A matter of timing.
I was going to ask why you didn't just rename in the Proc SQL and completely avoid that data step.
And since you were using a data set created with only those variables to begin with I was questioning why a KEEP at all???
The dataset options are processed in alphabetical order.
DROP=
KEEP=
RENAME=
WHERE=
You are trying to rename PriceAsofDateTime to DT_MKT, but that variable is not in the list of variables you kept from the source dataset.
D
K
R
W
happens to be alphabetical order, if that helps you remember the order.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.