Hi All,
Thanks in advance. I want to read the country name using following code, but unable to read the third and forth record properly observation properly it just read the CZECH RE not a full name of country, Please help me to read the observation correctly.
data country;
input country $ code $;
datalines;
Astria EUR
BELGIUM EUR
CZECH_REPUBLIC EUR
united Kingdom GBP
;
run;
please help me to read the data properly using datalines.
You need to indicate that the maximum number of characters in country is 15.
Also, you would make your life so much easier if you put a delimiter between country and code. Right now, because the space is the delimiter, there's really not a good way to know that "united" (which is separated by a space from) "kingdom" should be read as "united kingdom". Your program will decide that "united" is the country and "kingdom" is the code.
So, if you use a delimiter which is TWO spaces from the end of the country name, then you have data that is more easily read. Note the two spaces in the data between the last letter of country and the first letter of code. (Other delimiters could be chosen as well)
data country;
input country & $15. code $;
datalines;
Astria EUR
BELGIUM EUR
CZECH_REPUBLIC EUR
united Kingdom GBP
;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.