Or no need to make macro variable , just keyword _row_ enough. column .......... dummy ; <---- the last variable ......... define dummy/ computed NOPRINT ; compute dummy; /*Put all call define in it ,and don't make so many compute block*/ N+1; If Mod(N,2)=1 Then Do; Call Define(_row_,"Format","PValue."); Call Define(_row_,"Style","Style={BackGround=CorrSec.}"); End; endcomp;
Thank you very much @Ksharp, you helped me so much. After I change my code as below, it worked . What do you think? Does it seem dynamic and proper? I think I won't face any errors in future, If I use this code?
Ods Escapechar='~';
Options Missing=' ';
Proc Report Data=Spr2_&Suffix. Nowd SpanRows Style(Column)=[BorderColor=Black BorderWidth=1px]
Style(Header)=Header [BorderColor=Black BorderWidth=1px];
Column ("Spearman Correlation Coefficients, N = &Nobs
~n Prob > |r| under H0: Rho=0" Variable &ModelVar. Dummy);
Define Variable /Order ' ' Style(Column)=Header{VJust=C FontWeight=Bold Color=#112277} ;
%MakeDefine;
Define Dummy / Computed NoPrint;
Compute Dummy;
N+1;
If Mod(N,2)=1 Then Do;
%If &Count. GT 0 %Then %Do;
%Do j = 1 %to &Count.;
%Let Var&j = %Scan(&ModelVar.,&j,%str( ));
%Put Var&j= &&Var&j;
Call Define("&&Var&j","Style","Style={BackGround=CorrSec.}");
%End;
%End;
End;
Else Do;
%If &Count. GT 0 %Then %Do;
%Do j = 1 %to &Count.;
%Let Var&j = %Scan(&ModelVar.,&j,%str( ));
%Put Var&j= &&Var&j;
Call Define("&&Var&j","Format","PValue.");
%End;
%End;
End;
EndComp;
Run;
Thank you
Yeah. Code looks good and I hope so.
Thank you for your sensitivity and attention
Thank you very much @Cynthia_sas. I will consider your suggestions 🙂
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.