BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Maisha_Huq
Quartz | Level 8

Hello:

 

I use proc export to produce Excel spreadsheets, however, my variable names' labels are truncated.  The labels are truncated after my using the label statement in the proc export step.  Do you know what I can do to preserve the whole length of all labels?

 

Thank you!! Please let me know if I can be clearer/more specific.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Quick shot from the hip:

Could you please try what happens when you use dbms=xlsx instead of dbms=excel?

The dbms=excel method seems to have certain limitations because of the MS-supplied (yucc!) module used.

View solution in original post

4 REPLIES 4
Kurt_Bremser
Super User

Please post your code and example data (either make use of sashelp.class or similar, or post data in a data step) to llustrate what exactly happens.

Are parts of the labels missing, or are the columns just too narrow when the file is opened in Excel and need to be expanded?

Maisha_Huq
Quartz | Level 8

Hi KurtBremser,


Thanks for your response!  I've pasted my code below. 

 

Specifically, I have a data step where I create data set called test and include labels for the variables.  Then, I have a proc export step where I output the dataset test, specify which variables to keep (I list all variables; I use the KEEP statement because this was suggested as a possible solution to my labels being truncated), and include the LABEL statement.

 

However, I recieve ERROR: Too many fields defined.  If the first part of two of my labels are similiar (like in the sample code where the labels for the variables, referral and linkage, are similiar) then I recieve ERROR:  The field "If the client ...." has already been defined.

 

I'm outputting in Excel and not CSV because I need a workbook with mult. sheets.  Thank you for your help -- I appreciate it!!

 

***

data test; retain grantee_id client_id visit_dt data_issue form_typet rap_hepB_test_res_text rap_hepC_test_res_text rap_hep_retest_res_text

conf_hep_test_res_text rap_hepB_retest_res_text rap_hepC_retest_res_text conf_hepB_test_res conf_hepC_test_res clar_other grantee_note referral linkage

clar_received resolved data_period dup_id;

set test0;

label

client_id="Client ID"

visit_dt="Date of Visit"

data_issue="Data Issue"

rap_hepB_test_res_text="Rapid Hep B Test Result"     

rap_hepC_test_res_text="Rapid Hep C Test Result"     

rap_hep_retest_res_text="Rapid Hep Retest Result (Hep type not distinguished on form so we need to know what Hep type retest was for)"

conf_hep_test_res_text="Confirmatory Hep Test Result (Hep type not distinguished on form so we need to know what Hep type test was for or if client had confirmatory tests for both Hep B and Hep C)"   

rap_hepB_retest_res_text="Rapid Hep B Retest Result (enter result here if rapid Hep B retest given)"   

rap_hepC_retest_res_text="Rapid Hep C Retest Result (enter result here if rapid Hep B retest given)"   

conf_hepB_test_res="Confirmatory Hep B Test Result (enter result here if confirmatory Hep B test given)"    

conf_hepC_test_res="Confirmatory Hep C Test Result (enter result here if confirmatory Hep C test given)"

clar_other="Form Has Additional Clarification Requests on Other Tabs of This Excel File" 

grantee_note="Please Provide Data Updates Here"

referral="If client recieved positive Hep conf result, then please provide referral status"

linkage="If client recieved positive Hep conf result, then please provide linkage status"

run;

 

proc export data=test

outfile="filepath\filename..xlsx"

dbms=excel LABEL

replace;

sheet="HIV";

run;

 

 

Kurt_Bremser
Super User

Quick shot from the hip:

Could you please try what happens when you use dbms=xlsx instead of dbms=excel?

The dbms=excel method seems to have certain limitations because of the MS-supplied (yucc!) module used.

Maisha_Huq
Quartz | Level 8

Thank you, KurtBremser -- using "xlsx" instead of "excel" resolved the label issue!!

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
  • 4 replies
  • 2847 views
  • 1 like
  • 2 in conversation