06-21-2017 04:50 AM
i was using car dataset and trying to create a column MSRP inr with the help of MSRP column.
column was created but no values are showing in column MSRP inr..... help
libname jonty '/folders/myfolders/jonty';
FILENAME REFFILE '/folders/myfolders/jonty/CARS.csv';
PROC IMPORT DATAFILE=REFFILE replace
where make = "Dodge";
MSRP_inr = MSRP *65;
06-21-2017 04:58 AM
Because of the dollar sign, MSRP was imported by proc import (keep in mind that it only makes GUESSES about your data, and computers are dumb!) as character.
A string $12345 does not constitute valid numeric data, so you get ERRORs where SAS attempts an automatic conversion.
Take the data step code generated by the proc import from the log. Assign an informat of dollar9. to MSRP (log line 88), and remove the dollar sign after MSRP in the input statement (log line 119). You need to remove the log line numbers before you run the data step code, of course.