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

Morning all,

 

I am trying to read in a csv dataset with first and middle name and then a last name,and I know it trucates at 8 letters, but from reading forums I can't crack the code that imports the variables in their full format.

 

My current code (excluding length attempts is)

 

data namesofromanemperors_csv;

infile "/home/natelucaswelling0/romans/romanemperors.csv" firstobs=2 dlm=',' missover;

input studyno firstplusmiddle $ surname $;

run;

 

I have then tryed variations, but this results in variables being not included if they don't have 25 letters...

 

data namesofromanemperors_csv;

infile "/home/natelucaswelling0/romans/romanemperors.csv" firstobs=2 dlm=',' missover;

input studyno firstplusmiddle $25. surname $15.;

run;

 

Thanks in advance for advice

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

I think you are missing colon format modifier like this

data namesofromanemperors_csv;

infile "/home/natelucaswelling0/romans/romanemperors.csv" firstobs=2 dlm=',' missover;

input studyno firstplusmiddle : $25. surname : $15.;

run;

 

 or show us an example of couple of datalines samples please

View solution in original post

4 REPLIES 4
novinosrin
Tourmaline | Level 20

I think you are missing colon format modifier like this

data namesofromanemperors_csv;

infile "/home/natelucaswelling0/romans/romanemperors.csv" firstobs=2 dlm=',' missover;

input studyno firstplusmiddle : $25. surname : $15.;

run;

 

 or show us an example of couple of datalines samples please

underarmnat
Fluorite | Level 6

That worked perfect,

Thanks!

Andygray
Quartz | Level 8

@underarmnat If your question has been answered, you could mark as answered and close the thread

Andygray
Quartz | Level 8

Not mine. You should have marked whomsoever who gave you the solution. lol 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1967 views
  • 1 like
  • 3 in conversation