BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
tianerhu
Pyrite | Level 9
libname cert 'C:\SAS data and program\data\data set used in OG of SAS base\cert';
%let Location = USA;
data work.FlightEmpData;
set Cert.empdata cert.empdatu cert.empdatu2;
where Country = "&Location" and Salary >= 30000;
run;
proc sort data = work.FlightEmpData;
by descending Salary;
run;
proc export data = work.FlightEmpData
            outfile = 'C:\SAS data and program\program\10 scenarios of sas base OG\FlightEmpData.csv'
            dbms = csv
			replace;
run;

the code above generate a .csv file , like excel , like the following :

tianerhu_0-1631212926299.png

but the answer on the textbook : (it's a notepad)

tianerhu_2-1631213044687.png

how to generate a notepad as the answer on the book ?

1 ACCEPTED SOLUTION

Accepted Solutions
tianerhu
Pyrite | Level 9

Right-click on the file

select propertises

click Change...

select notepad

select Ok

select apply

This method works.

Thank you all for your helps.

View solution in original post

4 REPLIES 4
Tom
Super User Tom
Super User

A CSV file is a text file.  Why post a photograph text? Why not just post the text from the file?  For example from the command line just use the DOS type command to display the text of the file.  Or open the file with a text editor like notepad and then copy and paste the lines of text.

 

Be very careful opening a CSV with Excel as Excel will transform some of the text in the file based on its assumptions.  For example strings with digits separated by hyphens might get converted into a date value by Excel.

 

Reeza
Super User
CSV files open by default with Excel but CSV literally means comma (semicolon) separated data in a text file.
So open your file with NotePad and it will be exactly the same as the image.

In general, you actually shouldn't get in the habit of opening CSV with Excel. When you do that, Excel essentially runs it's own PROC IMPORT in the back end and converts the data so it may not match the text file. I once spent a long time debugging an issue with dates because Excel showed them as MMDDYY but they were actually DDMMYY in the CSV file. Never wasting 4 hours on that again.
tianerhu
Pyrite | Level 9

Right-click on the file

select propertises

click Change...

select notepad

select Ok

select apply

This method works.

Thank you all for your helps.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1123 views
  • 0 likes
  • 4 in conversation