Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using a One-Dimensional Array as a Lookup Table IN SAS Please provide a copy of

ID: 3698540 • Letter: U

Question

Using a One-Dimensional Array as a Lookup Table IN SAS

Please provide a copy of your ideal codes (or at least a framework to complete this)

Use arrays to create a data set named Trans that has 24 observations from a data set named Orion.shoe_stats

Shoe_stats table looks like

based on this table, the final output should look similar to

shoe stats Product23 Product24 Stat Product21 Product22 18 277 1 Frequency 2 Mfg Suggested_RetailPrice Mean 70.787878788 174.29241877 3 Mfg_Suggested_Retail Price_Min 4 Mfg Suggested_Retail Price_Max 5 Mfg_Suggested_Retail Price_Median 6 Mfg Suggested Retail Price_StdDev 21.730882067 71.702568882 173.05555556 17 130 68 13 385 164 398 190.5 141.38868921

Explanation / Answer

1)USING A ONE-DIMENSIONAL ARRAY TO PERFORM A TABLE LOOKUP.

here we use data set variable trans

that have 24 hr obsevation

PROGRAM:->

data work.diffs;

drop i;

set sasdata.productions

(drop=stat);

array trans{4} production{*} production21 - production24;

array diff{4};

do i=1 to dim(production); diff{i} =trans{i} - production{i};

end;

run;

here we set table

program

so write program

using datstep array

data work.rotate;

keep stat production amount TypeOfproduction;

set sasdata.production;

c array ex{*} _numeric_;

d array name{6} $ 32 ('frequency' 'shoes mean price' 'shoesmax price' 'shoes material ' 'shoes max price' ' meadianprice');

e do production = lbound(ex) to hbound(ex);

f price = ex{production};

g TypeOfproduction = name{production};

h output;

end;

run;

You can use the following SAS variables to reference variables that have been previously defined in the same DATA step: _NUMERIC_ indicates all numeric variables. _CHARACTER_ indicates all character variables. _ALL_ indicates all variables. For arrays, all the previously defined variables must be of the same type. In this case _NUMERIC_ refers to the variables EXPENSE1 – EXPENSE6. The SET statement must come before the ARRAY statement in order to refer to these variables with the _NUMERIC_ keyword. d Since the array NAME refers to character values, the ARRAY statement uses the $ to indicate character data and a length (32). The length needs to be established in the array statement; otherwise, SAS uses the default length of 8. You can use a length statement prior to the array statement to assign the length.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote