DATA Step, Macro, Functions and more

Reading sas file inside a excel file

Reply
Occasional Contributor
Posts: 6

Reading sas file inside a excel file

1) is it possible to read a SAS file which is embedded in excel file ?if at all yes!! how? pls find the attachment.

2) is it possible to read a .b1 extension file in SAS? for example test.b1 

 

Super User
Posts: 3,857

Re: Reading sas file inside a excel file

Posted in reply to Hemanth003

1) I can't think of any easy way programmatically. A simple File Save As in Excel or manual copy and paste will work. Personally I think it is bad practice to hide away SAS files inside another vendor's files. Why not store them as designed as simple text files?

2) Does the .b1 extension have any significance or is it simply just a text file containing data? If it is just a text file then no problem.  

Super User
Posts: 9,890

Re: Reading sas file inside a excel file

Posted in reply to Hemanth003

That somehow reminds me of the person that sent me a SAS log by embedding a screenshot in jpg format in an Excel file. Instead of just copy/pasting the text into the email.

 

Bottom line: don't even think about it. SAS files are SAS files and should always be stored as such.

If someone sent you that abomination, request to have data sent the right way.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super User
Posts: 9,890

Re: Reading sas file inside a excel file

Posted in reply to Hemanth003

Question 2: The extension is just part of the name, it does not tell you anything about the file's contents in a guaranteed way. If you rename garbage.xlsx to garbage.txt, it's still an Excel file, and you can't read it as text.

SAS will read any text file in a data step, even if it's named myfile.somestupidextensionimadeup

Look at the file documentation to decide how to import the contents into SAS.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 114 views
  • 0 likes
  • 3 in conversation