BookmarkSubscribeRSS Feed
pperin
Calcite | Level 5

Hello everyone,

I am sorry if this has been answered a billion times but I've been trying to work at this for 9 hours now. I am very slow to pick up I just need help.

I have a table output and I just want to export it. I am honestly super tired of using SAS right now. I Just wanted to get the labels output so that I can use something I am familiar with to generate the tables. I cannot work with no labels on anything just variables not right now.

 

I selected the variables I wanted to see in the data set and had it "show me the code for this table"

 

PROC SQL;
CREATE TABLE WORK.query AS
SELECT V161192 , V161193 , V161196x , V161267 , V161270 , V161290 , V161305a , V161310x , V161342 , V161361x , V162104 , V162135 , V161237 , V162152b , V162157 , V162158 , V162165 , V162170 , V162175 , V162176x , V162177 , V162263 , V162268 , V162269 , V162270 , V162271 , V162280
FROM _TEMP0.anes_timeseries_2016;
RUN;
QUIT;


PROC DATASETS NOLIST NODETAILS;
CONTENTS DATA=WORK.query OUT=WORK.details;
RUN;

PROC PRINT DATA=WORK.details;
RUN;


I just want to take the data that it shows me in the Output tab and export it so I can use it in Tableau or excel. This is honestly the most frustrating experience of my life.

 

image.png

2 REPLIES 2
Reeza
Super User
That’s likely because you’re new. Any new tool takes time. I’m sure the first time you used tableau and did a calculation and realized that you didn’t sum or divide correctly it was frustrating too. Or dealing with shape files.

Anyways, this is not that hard. Go to the Libraries section, find the data set you want to export, right click and voila. If it doesn’t come with the labels, you’ll want a proc export. The tasks should have an export procedure, try under Utilites I think. Or for proc export this will work, you’ll have to modify the file path but that depends on your set up, which I don’t know.

Proc export data = data2Export outfile = ‘/folders/myfolders/myFile.xlsx’ dbms=XLSX labels replace; run;

Sadly the browser seems to be replacing my quotes with smart quotes so you may need to fix this but otherwise this should work. Good Luck!

Oh, and check out the How To tutorials on video.sas.com, tons of helpful examples.
This one covers reading and exporting a csv data set, which is almost identical to the above code.
https://video.sas.com/detail/video/4664327156001/reading-and-generating-csv-files-using-snippets-in-...
ballardw
Super User

You may want to know that Tableau can use native SAS data sets also. Just tell Tableau where to find them and that they are SAS data sets.

 

This is only reliable if you save the SAS data set to library other than WORK though.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1793 views
  • 0 likes
  • 3 in conversation