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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 647 views
  • 0 likes
  • 2 in conversation