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

Hi,

I have a text file that looks like this:

State,State ANSI,County ANSI,County Name,ANSI Cl

AL,01,001,Autauga County,H1

AL,01,003,Baldwin County,H1

AL,01,005,Barbour County,H1

AL,01,007,Bibb County,H1

AL,01,009,Blount County,H1

AL,01,011,Bullock County,H1

The file is also attached.

How can I get this into SAS? I tried a few ways but I couldn't get it to have a data set with 5 columns with the corresponding headings.

Amanda

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

It actually appears to be a comma delimited file.  Couldn't you just use something like:

data want;

  infile "c:\art\names.txt" dlm="," dsd firstobs=2;

  length State State_ANSI ANSI_Cl $2;

  length County_ANSI $3;

  length County_Name $50;

  input State State_ANSI County_ANSI County_Name ANSI_Cl;

run;

View solution in original post

2 REPLIES 2
art297
Opal | Level 21

It actually appears to be a comma delimited file.  Couldn't you just use something like:

data want;

  infile "c:\art\names.txt" dlm="," dsd firstobs=2;

  length State State_ANSI ANSI_Cl $2;

  length County_ANSI $3;

  length County_Name $50;

  input State State_ANSI County_ANSI County_Name ANSI_Cl;

run;

acros
Calcite | Level 5

Sorry, yes, comma delimited. Thanks so much! The code worked perfect.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1106 views
  • 0 likes
  • 2 in conversation