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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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