Hi,
I have compared my solution to the solution shown for lesson 3, practice 5, but I only get a single row of output.
data is:
- pg3.storm_maxwindseasqtr
- pg3.storm_stats
Output line from my attempt:
![AlexEt_al_2021_1-1679913976371.png AlexEt_al_2021_1-1679913976371.png](https://communities.sas.com/t5/image/serverpage/image-id/82089iA73C42B8BC698087/image-size/medium?v=v2&px=400)
I have used ChatGPT to assess whether the solution and my solution is doing the same thing, and it seems to be doing the exact same thing, so I don't know where i'm going wrong.
I have also tried to use their keywords in the do-loops, but that has not solved
My Solution:
data work.MaxWind;
array MWTable[1980:2016,4] _temporary_;
if _N_=1 then do S=1980 to 2016;
set pg3.storm_maxwindseasqtr;
array MWQ[4] MaxWindQ1-MaxWindQ4;
do Q=1 to 4;
MWTable[S,Q]=MWQ[Q];
end;
end;
set pg3.storm_stats;
Qtr=qtr(StartDate);
MaxWindSQ=MWTable[Season,Qtr];
Difference=MaxWindMPH-MaxWindSQ;
drop S Q MaxWindQ1-MaxWindQ4;
run;
The guided solution is the following:
data work.MaxWind;
array MWTable[1980:2016,4] _temporary_;
if _N_=1 then do S=1980 to 2016;
set pg3.storm_maxwindseasqtr;
array MWQ[4] MaxWindQ1-MaxWindQ4;
do Q=1 to 4;
MWTable[S,Q]=MWQ[Q];
end;
end;
set pg3.storm_stats;
Qtr=qtr(StartDate);
MaxWindSQ=MWTable[Season,Qtr];
Difference=MaxWindMPH-MaxWindSQ;
drop S Q MaxWindQ1-MaxWindQ4;
run;
What am I doing wrong?
Best,
Alex