BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

I have a dataset in a sharedrive called myshare

The data I received is in a csv file with this format

1

Centerville

P O Box 6372
Eisley Station
Bridgeport, CT 06606

 

2

Iona Center

P.O Box 4512
Warentden, CT 06514

 

I am currently copying and pasting the data in a spreadsheet with created columns

to enable the code below to work and read left to right.  Is there a way to flip the data so I will not need to copy and paste to the individual variable names.

 

Data Chapters1;

INFILE '/myshare/folder1/Chapters.csv'

LRECL=32767

FIRSTOBS=2

ENCODING="LATIN1"

DLM=','

MISSOVER

DSD ;

INPUT District : $CHAR20.

Chapter : $CHAR20.

Address : $CHAR17.

City : $CHAR20.

State : $CHAR2.

ZIP :$CHAR10.

 

;

Run;

proc sort data= Chapters1;by Chapter;run;

 

1 REPLY 1
Reeza
Super User

Can you post an example of the text file here, not from Excel, just from a text editor so it's easier to understand. And a few more records to see the variation in patterns.

 

Is numerated, ie 1/2/3 or is that 1/2 in the example coincidental?

 

If it was always 3 records this would be easier but it is definitely doable. 

 

 

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
  • 1 reply
  • 566 views
  • 0 likes
  • 2 in conversation