DATA Step, Macro, Functions and more

change variable length in PROC datasets

Accepted Solution Solved
Reply
Contributor
Posts: 65
Accepted Solution

change variable length in PROC datasets

I am running regressions in a Macro, and after each regression, the estimates are appended to a dataset (COEFF). So, the length of the first variable (name of the parameter) is set after the first regression. This gives an issue where if parameters' names of later regressions are longer, they will be cut down, giving this WARNING message :

Variable Parameter has different lengths on BASE and DATA files (BASE 13 DATA 18).

I use the following code to append datasets after each regression:

PROC datasets nolist; append base=coeff data=temp force; RUN; 

where coeff does not exist before running any regression, temp is the parameter estimates of the current regression


Accepted Solutions
Solution
‎03-19-2018 01:01 PM
Super User
Posts: 24,000

Re: change variable length in PROC datasets

Posted in reply to ducman1611

In the regression use the NAMELEN option on the PROC statement to set the length so that its not truncated. You can also examine the PARMLABEL option to see the formatted label. 

 

And you cannot change the length via PROC DATASETS

 

You cannot change the length of a variable using the LENGTH statement or the LENGTH= option in an ATTRIB statement.

http://documentation.sas.com/?docsetId=proc&docsetTarget=p16vqq5oedlmkin1373cqyalhpo6.htm&docsetVers...

View solution in original post


All Replies
Solution
‎03-19-2018 01:01 PM
Super User
Posts: 24,000

Re: change variable length in PROC datasets

Posted in reply to ducman1611

In the regression use the NAMELEN option on the PROC statement to set the length so that its not truncated. You can also examine the PARMLABEL option to see the formatted label. 

 

And you cannot change the length via PROC DATASETS

 

You cannot change the length of a variable using the LENGTH statement or the LENGTH= option in an ATTRIB statement.

http://documentation.sas.com/?docsetId=proc&docsetTarget=p16vqq5oedlmkin1373cqyalhpo6.htm&docsetVers...

☑ This topic is solved.

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

Discussion stats
  • 1 reply
  • 217 views
  • 0 likes
  • 2 in conversation