I will guess that your error occurred when you imported the file and possibly read the first line (the variable name header) as data. The following worked for me:
data have;
format tradedate ddmmyy10.;
infile "c:\temp\buy_16mar2015.csv" dlm=',' firstobs=2;
input tradedate ddmmyy10. cusip :$15.;
run;
data want;
set have;
cusip = substr(cusip, 3, length(cusip)-4);
run;
Hi,
I will definitely do that. I was just checking all codes. And thanks a lot to everybody. I am grateful to all of you. I wanted to mark 'correct' or 'helpful' to everybody but I cannot.
Abu: Out of curiosity, why didn't Astounding's originally suggested code work for you?
Hi Arthur,
I don't know actually. It showed the following notes and output dataset had no observations.
NOTE: Numeric values have been converted to character values at the places given by:
(Line):(Column).
127:16
NOTE: Character values have been converted to numeric values at the places given by:
(Line):(Column).
127:9
It may be because I missed something while running the code. I also wanted to mark Astounding's code as correct or helpful answer, but I couldn't. After I marked two helpful answers, I found that I cannot choose anymore. But Astounding's code is really helpful (and may be correct; I don't know exactly since I could not run the code).
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.