02-07-2013 01:24 PM
Is the ASCII file delimited, fixed column or some other layout?
An example of what the file looks like could be very helpful in answering your question.
If the only thing you you are going to do is convert to Excel it may be worth going through the Excel import wizard.
02-07-2013 01:48 PM
is not delimited. for example:
10000001201 601asprin V32.0
10100038 31 103MULTI-VITAMIN V32.0
what I want to have is:
10000000 20 1 601 aspirin V32.0 ---- there are 'blank space' after the first '8 digits#', then '2 digits#', 'space','1 digit#', 'space', '3digits#', ,space', 'aspirin', 'space', 'v32.0'.
10100038 3 1 103 Multi-vitamin V32.0
sorry if I confuse you.
I try to import using Excel wizard, but there was any option for import .dat. file, so I chose .txt file, but the results is mess up, is not what I want.
thanks for your response.
02-07-2013 05:18 PM
It looks like have a fixed column file where each field starts in the same character position on the line. The approach to read with SAS would be to use an INFILE statement to tell which file to read then an INPUT statement that tells which columns to read for each variable.
infile "c:\data.dat" ; /* may need options if line is longer than 256*/
input var1 1-8 var2 9-10 var3 11 var4 12-15 var5 $ 16-39 var6 $ 40-44; /* using $ says to treat the variable as character not numeric*/
Or start Excel, using menus go to File-Open, navigate to the folder the file is in, set the file types to ALL Files (*.*) not All Excel files as you want to read something that doesn't have an existing Excel format. You will get a wizard box that displays the first few lines of the data and some options. Click on the Fixed width. If the actual data NOT headers you want starts on a row other than the first put the number of the first data row in the little box. Click on Next. There will be a few rows of data displayed with a ruler. You click in the body of the data to indicate where the values split. In your example above between the 100000001 and 20, between the 20 and the 1. A vertical line will display your choice. If you make a mistake double click the line to remove it. After you have indicated all of the breaks between the data fields, click next. You now have the option to tell Excel if each column is numeric or text or date and some appearance options. Click in each column and set options or skip the column. Then finish. If happy save it. Else start over.
02-07-2013 07:13 PM
thank you very much! I will try it later and will let you know.
I have another question, how to delete the default title of the Means procedure on the report?---- The Means Procedure --- I wan to suppress this title.
02-09-2013 12:09 AM
It depends how you generated that report. It looks a little like the output of PROC PRINT. If so you can add the NOOBS option to the PROC PRINT statement.
proc print data=summary noobs;
var n mean min max;