Hello SAS Community,
I'm having trouble reading this data as
Listing of Data Set LEARN.NAMES_AND_MORE
Name Phone Height Mixed
DATA LEARN.NAMES_AND_MORE;
INFILE DATALINES;
DATALINES;
Roger Cody (908)782-1234 5ft. 10in. 50 1/8 Thomas Jefferson (315) 848-8484 6ft. 1in. 23 1/2 Marco Polo (800)123-4567 5Ft. 6in. 40 Brian Watson (518)355-1766 5ft. 10in 89 3/4 Michael DeMarco (445)232-2233 6ft. 76 1/3
;
RUN;
I would fully appreciate if someone can help me,
Thank you!
Hmm, looks like you are trying to Learn SAS By Example (with help from author Ron Cody). Are you sure you want an answer from here? You won't learn very much that way!
Its for a school assignment, ive been trying so many methods but i cant get it to work.
Ive tried input @, #, column ranges, but the order is not correct 😕
The following code will get your data input. This INPUT statement tells SAS to read each field as a character string of the specified length (ex: 20 for Name). The & tells SAS that the field might contain an embedded blank and not to stop reading just for that.
data names_and_more;
input Name $ 20.
Phone & $ 14.
Height & $ 10.
Mixed & $ 8.;
datalines;
Roger Cody (908)782-1234 5ft. 10in. 50 1/8
Thomas Jefferson (315) 848-8484 6ft. 1in. 23 1/2
Marco Polo (800)123-4567 5Ft. 6in. 40
Brian Watson (518)355-1766 5ft. 10in 89 3/4
Michael DeMarco (445)232-2233 6ft. 76 1/3
;
I don't feel bad about giving this much to you, because this is supplied with the book materials as example code. However, your task is to parse out the phone number and measurements into their component parts so that you can perform calculations, categorize by area code, etc. I don't want to rob you of that learning opportunity, but I'll give you a hint about the fractions: it comes from our friends at sasCommunity.org.
https://support.sas.com/edu/schedules.html?ctry=us&id=2588
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.