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

Hello:

 

I have a problem when I am trying to create a SAS dataset.  As list below, the GEO_ID column contains the text  before the blank, such as '1400000US06001401300'.  While the GEO_display_lable contains the text after the blanks, such as '

Census Tract 4013, Alameda County, California'.    After I run my codes, I found all the text put into second column.   I think I need to add some dlm or dsd, but it didn't seem right.  Please advice how to fix it.  Thanks.

 

data have;

input geo_id $20. GEO_display_label $120.;

cards;

0400000US06 California

1400000US06001401300 Census Tract 4013, Alameda County, California

1400000US06037131400 Census Tract 1314, Los Angeles County, California

1400000US06037408627 Census Tract 4086.27, Los Angeles County, California

;

run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

I would take the easy way out:

 

data want;

length geo_id $ 20 geo_display_label $ 120;

input geo_id geo_display_label &;

cards;

0400000US06 California

1400000US06001401300 Census Tract 4013, Alameda County, California

1400000US06037131400 Census Tract 1314, Los Angeles County, California

1400000US06037408627 Census Tract 4086.27, Los Angeles County, California

;

View solution in original post

3 REPLIES 3
Reeza
Super User

What's the delimiter in the file? This looks like Census data so it's usually well formed...

 

Astounding
PROC Star

I would take the easy way out:

 

data want;

length geo_id $ 20 geo_display_label $ 120;

input geo_id geo_display_label &;

cards;

0400000US06 California

1400000US06001401300 Census Tract 4013, Alameda County, California

1400000US06037131400 Census Tract 1314, Los Angeles County, California

1400000US06037408627 Census Tract 4086.27, Los Angeles County, California

;

ybz12003
Rhodochrosite | Level 12

Cool, Astounding!

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 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.

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
  • 3 replies
  • 715 views
  • 3 likes
  • 3 in conversation