here i want to change the variable from char to numeric so i used input and i gave the format as well and i want to get the simplest way to create it.
code :-
data carz;
set work.import
(rename= (MSRP = MSRP1,Invoice = Invoice1));
MSRP = input(MSRP1, dollar12.);
Invoice = input(Invoice1, dollar12.);
format Invoice Dollar12.;
format MSRP Dollar12.;
drop MSRP1 Invoice1;
run;
log errors :-
I believe there is a correction required in the rename option, no comma is required to rename two or more variables. Please try the updated code
data carz;
set work.import(rename= (MSRP = MSRP1 Invoice = Invoice1));
MSRP = input(MSRP1, dollar12.);
Invoice = input(Invoice1, dollar12.);
format Invoice MSRP Dollar12.;
drop MSRP1 Invoice1;
run;
If you post the log into a code box opened using the forum {i} menu icon then the text format will be as in your log. As pasted into a message window the forum removes most of the leading spaces. So the underscore of error message that should have appeared under the comma, indicating that was where SAS found an error in the syntax, is not in the correct place.
Note that the text is telling you the same thing: Variable name , is not valid.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.