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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.