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

Hi all,

I have a question regarding the following warning message in the log.

WARNING: Multiple lengths were specified for the variable variable by input data set(s). This can
cause truncation of data.

In my output table, some of the variables are cut off (f.e. c_cogs_ instead of c_cogs_s_t), although there is enough space in the cell.

The code is the following:


%Macro NW_TS_EARN_m5 (ann_file=, var=, yearvar=);

data nw_earn_m5 (keep= &yearvar. estimate);
set &ann_file.;
rename &var.=estimate;
if _TYPE_="PARMS";
if _model_="MODEL5";
Run;

 

proc sort data= nw_earn_m5;
by &yearvar.;
run;

 

ods output parameterestimates=nw_tsavg_earn_m5_&var;
ods listing close;
%let lags=1;
proc model data=nw_earn_m5;
instruments / intonly;
estimate = a;
fit estimate / gmm kernel=(bart, %eval (&lags+1),0) vardef=n;
run;
quit;


ODS listing;

Data nw_tsavg_earn_m5_&var;
set nw_tsavg_earn_m5_&var;
if not(missing(probt))and probt <=0.01 then St='***';
else if not(missing(probt)) and Probt>0.01 and Probt<0.05 then St='**';
else if not(missing(probt)) and probt>0.05 and probt <=0.10 then St='*';
else St='';
rename estimate=nwavg
tvalue=tv
probt=pv;
run;

 

data nw_tsavg_earn_m5_&var;
retain nwavg pv st tv;
set nw_tsavg_earn_m5_&var (keep=nwavg st pv tv);
FORMAT st $3.
pv 6.4
tv 7.3;
run;

 

data nw_tsavg_earn_m5_&var;
retain variable;
set nw_tsavg_earn_m5_&var;
variable= "&var.";
format variable 12.0;
run;

 

proc sql;
drop table nw_Earn_m5;
quit;

 

data mylibf1.earn_m5_nw;
set nw_tsavg_earn_m5_:;
run;


%mend;
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=intercept, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=BV_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=NegE, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=NEGEE_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=c_sales_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=c_cogs_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=c_oe_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=c_int_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=c_tax_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=c_other_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=del_ar_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=del_inv_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=del_ap_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=depr_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=amort_s_t, yearvar=Houyear);
%NW_TS_EARN_m5( ann_file=mylibf1.reg_parms_earn, var=oth_acc_s_t, yearvar=Houyear);

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

By doing this

variable= "&var.";

you define variable with the length of the contents of macro parameter var.

Since these contents have a different length, you get different lengths when you concatenate the datasets.

Solution: set a sufficient length with an explicit LENGTH statement.

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

By doing this

variable= "&var.";

you define variable with the length of the contents of macro parameter var.

Since these contents have a different length, you get different lengths when you concatenate the datasets.

Solution: set a sufficient length with an explicit LENGTH statement.

DomUk
Fluorite | Level 6
thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 486 views
  • 0 likes
  • 2 in conversation