excel file converted to ASCII

Sean_biology

New Member
Joined
Jan 9, 2009
Messages
10
Hi there,

I am tasked with compiling data fin excel Excel and saving as an ASCII file that is readable by SAS statistics.

how do I convert an excel sheet to an ASCII?

thanks much

Sean
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
You can use File > Save As and select Text (*.txt) as the file type. Or heres an example using a macro (the .txt file must exist before running it):

Code:
Sub MyOutput()
Dim iMyFreeFile As Integer, LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
iMyFreeFile = FreeFile
Open "C:\testfile.txt" For Output As #iMyFreeFile
For i = 1 To LR
    Write #iMyFreeFile, Range("A" & i).Value, Range("B" & i).Value, Range("C" & i).Value, Range("D" & i).Value, Range("E" & i).Value
Next i
Close #iMyFreeFile
End Sub
 
Upvote 0
Sean, Is this PC SAS? Or SAS on a mainframe?
For PC SAS, it can read in XLS files very easily.
If it's a main frame, try saving the worksheet as a .CSV file, then SAS can read it using an infile statement with delimiter = ','.
 
Upvote 0

Forum statistics

Threads
1,215,005
Messages
6,122,661
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top