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 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1097 views
  • 1 like
  • 3 in conversation