Hello Everyone, So I have the following data that I am trying to transpose: Obs Stat Product21 Product22 Product23 Product24 1 Frequency 66.000 277.000 . 18.000 2 Mfg_Suggested_Retail_Price_Mean 70.788 174.292 . 173.056 3 Mfg_Suggested_Retail_Price_Min 17.000 13.000 . 5.000 4 Mfg_Suggested_Retail_Price_Max 130.000 385.000 . 398.000 5 Mfg_Suggested_Retail_Price_Median 68.000 164.000 . 190.500 6 Mfg_Suggested_Retail_Price_StdDev 21.731 71.703 . 141.389 This is the code that I have so far in order to do this: data trans (keep=Statistic Price ProductLine); /*Creating SAS data set trans*/ set orion.shoe_stats; /*Using orion.shoe_stats*/ array Prod{*} _numeric_; /*Creating array Prod*/ array StatS{1:6} $50. ('Frequency','Mfg_Suggested_Retail_Price_Mean','Mfg_Suggested_Retail_Price_Min','Mfg_Suggested_Retail_Price_Max' ,'Mfg_Suggested_Retail_Price_Median','Mfg_Suggested_Retail_Price_StdDev'); /*Creating StatS array with all of the different statistics Using a DO loop as this was suggested through a website*/ do i=1 to dim(Prod); Price=StatS{i}; Statistic=Prod{i}; output; end; run; proc print data=shortrotate label; label Price='Product'; run; The problem that I am having is that I have to create a variable Product_Line that get the number of the product from the Product name. I am not sure how to do this if I am supposed to put in a scan statement into my DO loop in order to scan for the number from the Product Name or what I am supposed to do. I have tried this where I created a product_line array and then set it's value to i, but that didn't work: data trans (keep=Statistic Price PL); /*Creating SAS data set trans*/ set orion.shoe_stats; /*Using orion.shoe_stats*/ array Prod{*} _numeric_; /*Creating array Prod*/ array StatS{1:6} $50. ('Frequency','Mfg_Suggested_Retail_Price_Mean','Mfg_Suggested_Retail_Price_Min','Mfg_Suggested_Retail_Price_Max' ,'Mfg_Suggested_Retail_Price_Median','Mfg_Suggested_Retail_Price_StdDev'); product_line{*} _numeric_; /*Creating StatS array with all of the different statistics Using a DO loop as this was suggested through a website*/ do i=1 to dim(Prod); Price=StatS{i}; Statistic=Prod{i}; PL=product_line{i} output; end; run; proc print data=shortrotate label; label Price='Product'; run; If anyone has any suggestions, that would be greatly appreciated. Here is what the final result supposed to be: The TRANS data set Product_ Obs Stat Line Value 1 Frequency 21 66.000 2 Frequency 22 277.000 3 Frequency 23 . 4 Frequency 24 18.000 5 Mfg_Suggested_Retail_Price_Mean 21 70.788 6 Mfg_Suggested_Retail_Price_Mean 22 174.292 7 Mfg_Suggested_Retail_Price_Mean 23 . 8 Mfg_Suggested_Retail_Price_Mean 24 173.056 9 Mfg_Suggested_Retail_Price_Min 21 17.000 10 Mfg_Suggested_Retail_Price_Min 22 13.000 11 Mfg_Suggested_Retail_Price_Min 23 . 12 Mfg_Suggested_Retail_Price_Min 24 5.000 13 Mfg_Suggested_Retail_Price_Max 21 130.000 14 Mfg_Suggested_Retail_Price_Max 22 385.000 15 Mfg_Suggested_Retail_Price_Max 23 . Thanks, Alisa
... View more