DATA Step, Macro, Functions and more

Proc export trunncating my label

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 131
Accepted Solution

Proc export trunncating my label

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.

 

 


Accepted Solutions
Solution
‎02-13-2017 11:14 AM
Super User
Posts: 6,964

Re: Proc export trunncating my label

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Posts: 6,964

Re: Proc export trunncating my label

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?

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Frequent Contributor
Posts: 131

Re: Proc export trunncating my label

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;

 

 

Solution
‎02-13-2017 11:14 AM
Super User
Posts: 6,964

Re: Proc export trunncating my label

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.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Frequent Contributor
Posts: 131

Re: Proc export trunncating my label

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

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 272 views
  • 1 like
  • 2 in conversation