BookmarkSubscribeRSS Feed
ssas
Calcite | Level 5
Hi,
I have a an csv file with the following way. I would like to import into sas with appropriate coumn names and values.
my working environment is windows, SAS base,stat and graph



Full Name Phone Event Event Date Hall Area Row Seats Price Price Level Price Types

Transaction No. Transaction Date Transaction Type User Name: Status: Number of Tickets: Total Amount

361640 12/04/2008 14:24 Phone Holland, P Sales 6 $95.00

Smith S 235977 Cinderella 2008 21/12/2008 14:00 The Central Theatre Balcony A 32-33 18.5 Band A Standard Clearing
Smith S 235977 Cinderella 2008 21/12/2008 14:00 The Central Theatre Balcony A 34-35 15.5 Band A Senior Citizen Clearing
Smith S 235977 Cinderella 2008 21/12/2008 14:00 The Central Theatre Balcony A 36-37 13.5 Band A Under 16 Clearing
Transaction No. Transaction Date Transaction Type User Name: Status: Number of Tickets: Total Amount

361678 12/04/2008 17:50 Phone Lycett, S Sales 14 $220.00

Allen A 07913 037009 Cinderella 2008 24/12/2008 14:00 The Central Theatre Balcony A 32-34 15.5 Band A Senior Citizen Clearing
Allen A 07913 037009 Cinderella 2008 24/12/2008 14:00 The Central Theatre Balcony A 35-39 18.5 Band A Standard Clearing
Allen A 07913 037009 Cinderella 2008 24/12/2008 14:00 The Central Theatre Balcony A 40-41 13.5 Band A Under 16 Clearing
Allen A 07913 037009 Cinderella 2008 24/12/2008 14:00 The Central Theatre Balcony B 32-35 13.5 Band A Under 16 Clearing
Transaction No. Transaction Date Transaction Type User Name: Status: Number of Tickets: Total Amount

361686 12/04/2008 18:41 internet Internet Sales 3 $50.50

i would like to see
Full Name Phone Event Event Date Hall Area Row Seats Price Price Level Price Types Transaction No. Transaction Date Transaction Type User Name: Status: Number of Tickets: Total Amount
Smith S 235977 Cinderella 2008 21/12/2008 14:00 The Central Theatre Balcony A 32-33 18.5 Band A Standard Clearing
Smith S 235977 Cinderella 2008 21/12/2008 14:00 The Central Theatre Balcony A 34-35 15.5 Band A Senior Citizen Clearing
Smith S 235977 Cinderella 2008 21/12/2008 14:00 The Central Theatre Balcony A 36-37 13.5 Band A Under 16 Clear

361640 12/04/2008 14:24 Phone Holland, P Sales 6 $95.00
1 REPLY 1
deleted_user
Not applicable
1) Not going to be done with PROC IMPORT as the input lines do not follow normalized format (= every line must have identically the same format).

2) The example contains 0 (none, nada, zip, zilch) commas in it as delimiters.

3) To read the presented data with SAS, parse it, and put it into a SAS data set can be done, but it will require a DATA step, INFILE, INPUT, '@' and some conditional (IF) statements.

Example:

example data in file "dummy.txt":

This is the first line
This is the second line
Different format line 1
This is the fourth line
This is the fifth line
Different format line 2


data indata;
length first $32;
infile "dummy.txt";
input first $ @;
if first = "Different" then do;
input second $ third $ fourth;
end;
else do;
input remainder $;
end;
run;
quit;
Message was edited by: Chuck

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!

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