BookmarkSubscribeRSS Feed
jonty
Fluorite | Level 6

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 :-

 

data carz;
64 set work.import
65 (rename= (MSRP = MSRP1,Invoice = Invoice1));
_
214
23
_______
79
ERROR 214-322: Variable name , is not valid.
 
ERROR 23-7: Invalid value for the RENAME option.
 
ERROR 79-322: Expecting a =.
 
66 MSRP = input(MSRP1, dollar12.);
67 Invoice = input(Invoice1, dollar12.);
68 format Invoice Dollar12.;
69 format MSRP Dollar12.;
70 drop MSRP1 Invoice1;
71 run;
 
 
 
2 REPLIES 2
Jagadishkatam
Amethyst | Level 16

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;
Thanks,
Jag
ballardw
Super User

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.

 comma is not a valid variable name.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1504 views
  • 4 likes
  • 3 in conversation