data have ;
infile cards dlm=',' ;
input (a1-a4) ($10.) ;
cards ;
a ,b, c, d
;
is the above program correct to assign length to all character variables at a time
if it is wrong then how can i do?
The way to assign a length to a variable is to use a LENGTH statement. You can also use the LENGTH= attribute in an ATTRIB statement.
length A1-A4 $10 ;
If you want to let the compiler GUESS what length you want to use for your variables based on how you first use them then you could use your method of using an informat in the INPUT statement. But for delimited data make sure to use the colon modifier to prevent the INPUT statement from using formatted input mode and messing up the parsing of the line around the delimiters.
data have ;
infile cards dsd dlm=',' truncover;
input (a1-a4) (:$10.) ;
cards ;
a,b,c,d
;
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.