BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sharvey8
Calcite | Level 5

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;

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

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

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

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

sharvey8
Calcite | Level 5
I changed the data set name just to NBADraft and it still is not working
novinosrin
Tourmaline | Level 20

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;

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 852 views
  • 0 likes
  • 2 in conversation