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:
Output line from my attempt:
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
I think you need to add _N_ = 1, otherwise the IF statement will be true for every iteration of the data step.
I think you need to add _N_ = 1, otherwise the IF statement will be true for every iteration of the data step.
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!
Follow along as SAS’ Robert Blanchard explains three aspects of autotuning in a deep learning context: globalized search, localized search and an in parallel method using SAS.
Find more tutorials on the SAS Users YouTube channel.