I am trying to read in this data set. These are the first few rows to the data set. what am I doing wrong?
LastName,FirstName,Team,Position,Birthdate,Height,Wingspan,Weight
Fultz,Markelle,76ers,PG,05-29-98,76,81.75,195
Ball,Lonzo,Lakers,PG,10-27-97,78,79,190
Tatum,Jayson,Celtics,SF,03-03-98,80,83,204
Jackson,Josh,Suns,SF,02-10-97,80,81.75,203
Fox,De'Aaron,Kings,PG,12-20-97,76,78.5,171
Isaac,Jonathan,Magic,SF/PF,10-03-97,83,85.25,205
Markkanen,Lauri,Bulls,PF,05-22-97,84,,225
Ntilikina,Frank,Knicks,PG,07-28-98,77,,170
Smith,Dennis,Mavericks,PG,11-25-97,75,75,195
Collins,Zach,Trail Blazers,PF/C,11-19-97,84,85,230
Monk,Malik,Hornets,SG,02-04-98,76,75.5,197
Kennard,Luke,Pistons,SG,06-25-96,78,77.25,202
DATA 2017NBADraft;
INFILE 'C:\Users\sharvey8\Desktop\2017NBADraft.txt' DLM=',' DSD firstobs=2;
INPUT LastName :$10. FirstName :$10. Team :$20, Position :$5. BirthDate :ANYDTDTE10. Height Wingspan Weight;
RUN;
PROC PRINT DATA=2017NBADraft;
RUN;
What's the problem other than the name of the dataset 2017NBADraft not conforming to SAS naming convention?
You can't have a dataset name starting with a number
What's the problem other than the name of the dataset 2017NBADraft not conforming to SAS naming convention?
You can't have a dataset name starting with a number
Hi @sharvey8 You have one typo here in your INPUT statement i.e. ,
DATA 2017NBADraft;
INFILE 'C:\Users\sharvey8\Desktop\2017NBADraft.txt' DLM=',' DSD firstobs=2;
INPUT LastName :$10. FirstName :$10. Team :$20, Position :$5. BirthDate :ANYDTDTE10. Height Wingspan Weight;
RUN;
Try the corrected below-
DATA NBADraft ;
INFILE 'C:\Users\sharvey8\Desktop\2017NBADraft.txt' DSD firstobs=2 truncover;
INPUT LastName :$10. FirstName :$10. Team :$20. Position :$5. BirthDate :ANYDTDTE10. Height Wingspan Weight;
RUN;
Here is a test:
DATA NBADraft;
INFILE cards DSD firstobs=2 truncover;
INPUT LastName :$10. FirstName :$10. Team :$20. Position :$5. BirthDate :ANYDTDTE10. Height Wingspan Weight;
cards;
LastName,FirstName,Team,Position,Birthdate,Height,Wingspan,Weight
Fultz,Markelle,76ers,PG,05-29-98,76,81.75,195
Ball,Lonzo,Lakers,PG,10-27-97,78,79,190
Tatum,Jayson,Celtics,SF,03-03-98,80,83,204
Jackson,Josh,Suns,SF,02-10-97,80,81.75,203
Fox,De'Aaron,Kings,PG,12-20-97,76,78.5,171
Isaac,Jonathan,Magic,SF/PF,10-03-97,83,85.25,205
Markkanen,Lauri,Bulls,PF,05-22-97,84,,225
Ntilikina,Frank,Knicks,PG,07-28-98,77,,170
Smith,Dennis,Mavericks,PG,11-25-97,75,75,195
Collins,Zach,Trail Blazers,PF/C,11-19-97,84,85,230
Monk,Malik,Hornets,SG,02-04-98,76,75.5,197
Kennard,Luke,Pistons,SG,06-25-96,78,77.25,202
;
RUN;
LOG:
136 DATA NBADraft;
137
138 INFILE cards DSD firstobs=2 truncover;
139
140 INPUT LastName :$10. FirstName :$10. Team :$20. Position :$5. BirthDate :ANYDTDTE10. Height
140! Wingspan Weight;
141 cards;
NOTE: The data set WORK.NBADRAFT has 12 observations and 8 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.03 seconds
155 ;
156 RUN;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.