I am quite new to SAS. I have got a file with file extension .sas7bdat which contains daily stocks prices and percentage changes. It has almost 2 million line items. I know that I can simply double click the file and open it with SAS 9.4. But, I am looking for codes which I can type in Editor and open this file. Please help me.
After I open this file, I need to export it to excel. Since it has 2 million data, I can not export everything in a single excel tab. So, What I want to do it randomly pick (say 10,000 or 20,000) data and export only this randomly picked data to excel.
My .sas7bdat file is on desktop.
Please help.
Something like:
libname tmp "c:/temp"; proc surveyselect data=tmp.stockprices method=srs n=10000 out=sample; run; proc export data=sample outfile="c:/temp/want.xlsx"; run;
You should really look through the SAS online help videos and such like and learn SAS, as this is a step 1 learning question. You point what is called a library reference to a folder which contains .sas7bdat files, then refer to the library and dataset name. For instance if I had saved in c:/temp that file:
libname tmp "c:/temp"; proc export data=tmp.stockprices outfile="c:/temp/want.xlsx"; run;
You can't, if Excel has limits then that is the limit for that file. Split the data, or use a better format for your data. Obviously depends on what the data is for, not much point creating a report with 2mill records, so I assume this is for data transfer? If so use CSV, plain text delimited format, can have unlimited rows, and can easily be read by the receiving party.
Something like:
libname tmp "c:/temp"; proc surveyselect data=tmp.stockprices method=srs n=10000 out=sample; run; proc export data=sample outfile="c:/temp/want.xlsx"; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.