You could make a MACRO to yield these statements.
%macro array(map=);
array ma[&map.]/nosymbols;
%do i=1 %to &map.;
ma[&i.]=&i.;
%end;
%mend;
%put %bquote( %array(map=3) ) ;
%put %bquote( %array(map=4) ) ;
94 %macro array(map=); 95 array ma[&map.]/nosymbols; 96 %do i=1 %to &map.; 97 ma[&i.]=&i.; 98 %end; 99 %mend; 100 101 %put %bquote( %array(map=3) ) ; array ma[3]/nosymbols; ma[1]=1; ma[2]=2; ma[3]=3; 102 %put %bquote( %array(map=4) ) ; array ma[4]/nosymbols; ma[1]=1; ma[2]=2; ma[3]=3; ma[4]=4;
I think you may need to go back a bit and describe what is going on. Write where? to a text file? data set? SAS Log? SAS Results window? SAS Output window? Word document? something else?
Where is the value "3" coming from? A macro variable? A data set? The result of a calculation?
And possibly which programming language you are discussing. I am not familiar with " /nosymbols" involved with arrays.
ARRAY array-name[dimensions] </NOSYMBOLS> | <variable(s)> | <constant(s)> | <initial-values)>;
PROC FCMP
@ballardw wrote:
I think you may need to go back a bit and describe what is going on. Write where? to a text file? data set? Word document? something else?
Where is the value "3" coming from? A macro variable? A data set? The result of a calculation?
And possibly which programming language you are discussing. I am not familiar with " /nosymbols" involved with arrays.
This may be helpful, but you will have to figure how to adapt to your specific needs.
49 data _null_;
50 array ma[4] _temporary_ (11:14);
51 do i = 1 to dim(ma);
52 put ma[i]= +(-1) ';';
53 end;
54 run;
ma[1]=11;
ma[2]=12;
ma[3]=13;
ma[4]=14;
You could make a MACRO to yield these statements.
%macro array(map=);
array ma[&map.]/nosymbols;
%do i=1 %to &map.;
ma[&i.]=&i.;
%end;
%mend;
%put %bquote( %array(map=3) ) ;
%put %bquote( %array(map=4) ) ;
94 %macro array(map=); 95 array ma[&map.]/nosymbols; 96 %do i=1 %to &map.; 97 ma[&i.]=&i.; 98 %end; 99 %mend; 100 101 %put %bquote( %array(map=3) ) ; array ma[3]/nosymbols; ma[1]=1; ma[2]=2; ma[3]=3; 102 %put %bquote( %array(map=4) ) ; array ma[4]/nosymbols; ma[1]=1; ma[2]=2; ma[3]=3; ma[4]=4;
What is a "map section"?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.