12-10-2015 06:47 PM
Hello SAS Community,
I'm having trouble reading this data as
Listing of Data Set LEARN.NAMES_AND_MORE
Name Phone Height Mixed
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 would fully appreciate if someone can help me,
12-10-2015 07:50 PM
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!
12-11-2015 07:56 AM
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.