BookmarkSubscribeRSS Feed
singhsahab
Lapis Lazuli | Level 10

Hi All,

 

I've a dataset called test which have three varibales ID, Q1 and Q2. While exporting dataset into CSV format with the label name label names not appers in output file,only varibale original name appers in output . i'm using below code 

 

proc export data=readin outfile="\\path\read.csv"
dbms=csv Replace;
LABEL Q1="QUA 1" Q2="QUA 2";
run;

 

Thank you to all in advance !!!

5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

proc export does not support the label statement.

 

ChrisBrooks
Ammonite | Level 13

Actually it does support the label statement but there are two things wrong wrong with your code:

 

1. It only supports variable labels on the data set - you can't change them during the Proc Expand; and

 

2. You've put your label statement in the wrong place - it goes BEFORE the first semi-colon e.g.

 

proc export data=sashelp.cars outfile="/folders/myshortcuts/Dropbox/cars.csv" label ;
dbms=csv;
run;
ChrisNZ
Tourmaline | Level 20
The label statement must be used in a prior step before the proc export as it is not supported. Then the label option can be used to export the labels instead of the names.
ChrisBrooks
Ammonite | Level 13

You're right @ChrisNZ it is actually an option in Proc Export and not a statement - i admit I sometimes tend to use the terms interchangeably 🙂

ChrisNZ
Tourmaline | Level 20
I have a bit of OCD with terminology.
Not that it prevents me from making mistakes. 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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
  • 5 replies
  • 2158 views
  • 5 likes
  • 3 in conversation