%Let pth = /share/sas_tmp; data have; length dept $25 month_ 4 count_ 8 current 8 ; input dept month_ :monyy5. count_ current; format month_ yymmd7.; datalines; Atlantic JAN20 1 1 Atlantic JAN20 1 0 Central FEB20 1 1 Central APR20 1 1 Central MAR20 1 0 Pacific APR20 1 0 Pacific FEB20 1 1 ; run; proc sql; create table have2 as select dept label = 'Department', month_ label = 'Month', count_ label = 'Count', current label = 'Current' from have ;quit; proc export data=work.have2 outfile="/&pth./have3.csv" label dbms=csv; run;
1. Files successfully writes to the sharefolder location. The desire is a csv file however it saves as an excel. I dont know why
2. I want one output file however I want to separate into tabs based on the Department
3. I need a header in the first two rows so the actual data should start on the third row
Desired output in my export is as follows with a separate tab based on the Department:
7 | 3 | Data Needed | ||
Key | Loan Data | Current Data | ||
Department | Month | Count | Current | |
Atlantic | 2020-01 | 1 | 1 | |
Atlantic | 2020-01 | 1 | 0 | |
Central | 2020-02 | 1 | 1 | |
Central | 2020-04 | 1 | 1 | |
Central | 2020-03 | 1 | 0 | |
Pacific | 2020-04 | 1 | 0 | |
Pacific | 2020-02 | 1 | 1 |
@Q1983 wrote:1
.....
1. Files successfully writes to the sharefolder location. The desire is a csv file however it saves as an excel. I dont know why
2. I want one output file however I want to separate into tabs based on the Department
3. I need a header in the first two rows so the actual data should start on the third row
- Your code strongly suggests that you're creating a .csv file.
- A .csv file is just a text file where you can't have things like tabs. If you want tabs then the output format should become an actual Excel file.
- ODS EXCEL should allow you to do all you need. There are quite a few examples out there already which should give you all the pointers you need.
The desire is a csv file however it saves as an excel. I dont know why
Your code creates a csv file, but Windows thinks all csv files are meant to be opened with Excel. That's all.
Make it a habit to set Windiws Explorer to show
so that you see all pertinent information for a file, regardless of its association.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.