Hi community,
I'm not sure if my output is correct for this array problem. Any suggestions are greatly appreciated. Thank you!
1. Set up arrays to meet the following requirements:
Array math has three elements, Jan, Feb and Mar. Their initial values are “January”, “February” and “March”.
Since the array statement will be the first reference to these variables, pay particular attention to their length.;
Below is my answer:
data b; array math (3) Jan Feb Mar; do i=1 to 3; end; proc print; run; Obs Jan Feb Mar i 1 . . . 4
@Amy0223 wrote:
Hi community,
I'm not sure if my output is correct for this array problem. Any suggestions are greatly appreciated. Thank you!
1. Set up arrays to meet the following requirements:
Array math has three elements, Jan, Feb and Mar. Their initial values are “January”, “February” and “March”.
Since the array statement will be the first reference to these variables, pay particular attention to their length.;
Below is my answer:
data b; array math (3) Jan Feb Mar; do i=1 to 3; end; proc print; run; Obs Jan Feb Mar i 1 . . . 4
I think this is not a situation where arrays are needed! But ... it seems as if the answer is expected to contain usage of arrays. And thus a very poor question.
Nevertheless
array math {3} $ 8 jan feb mar ('January','February','March');
@Amy0223 wrote:
Hi community,
I'm not sure if my output is correct for this array problem. Any suggestions are greatly appreciated. Thank you!
1. Set up arrays to meet the following requirements:
Array math has three elements, Jan, Feb and Mar. Their initial values are “January”, “February” and “March”.
Since the array statement will be the first reference to these variables, pay particular attention to their length.;
Below is my answer:
data b; array math (3) Jan Feb Mar; do i=1 to 3; end; proc print; run; Obs Jan Feb Mar i 1 . . . 4
I think this is not a situation where arrays are needed! But ... it seems as if the answer is expected to contain usage of arrays. And thus a very poor question.
Nevertheless
array math {3} $ 8 jan feb mar ('January','February','March');
This will do
data b;
array math{3} $ Jan Feb Mar ('January' 'February' 'March');
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.