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).
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.