by applying a user-defined format to the Month variable in a DATA step. Using SAS – I have a data set 192 obs, 3 vars (Year – rep’d as 2003-2018 (each year rep’d 12 times for each month which has it’s values rep’d as 1-12, then the 3rd var is GasPrice.
I have a data set that essentially looks like:
Year Month GasPrice (like I said 192 obs) I want it to look like : Year | GasPr_QT1 | GasPr_Q2 | GasPr_Q3 | GasPrice_Q4
5 vars and 15 rows. As I am trying to figure out how to code for QTR or each of the 15 years in the data set and then I need to figure out the sum of the quarters for each year. Am I dreaming here – is this too crazy?
Thank you for any suggestions help advice ANYTHING! Rows 1-100
Total rows: 192Total columns: 3
Can I turn this data set – w 192 obs and 3 vars Year (2003-2018 each ob consists of each year, the month (as 1-12) and vaious gasprice (ex 1.46) I am hoping to get it to be 5 vars – Year | Q1_GP | Q2_GP | Q3_GP | Q4_GP and 15 obs (1 per year)But my FIRST problem is part c. How do I get the (in ascending order already) years to split off in Qtrs? I see so many steps and statement possibilities but they don’t seem to answer my question. My last code did it – but is this the best way? :Total rows: 192Total columns: 9YearMonthGasPriceQ1QRT1Q2Q3Q4quarter1200311.4731….12200321.6411….23200331.7481….34200341.659..2..45200351.542..2..56200361.514..2..67200371.524…3.78200381.628…3.89200391.728…3.9102003101.603….410112003111.535….411122003121.494….41213200411.5921….114200421.6721….215200431.7661….316200441.833..2..417200452.009..2..518200462.041..2..6User: u68888711Messages
“C:Users15707OneDriveMyExcelWINZIP_INFOSAS Studio.html” Still trying to figure this site out
The United States Bureau of Labor Statistics publishes various indexes that measure average prices of consumer goods in urban areas. The SAS data set called GAS contains data on the average price of unleaded regular gasoline (per gallon) for recent years by months in the United States. The variables in this file are year, month, and average gasoline price.a. Review the names, labels, and attributes of the variables in the SAS data set GAS. Record the label and variable type for GASPRICE as a comment in your program.b. Identify the minimum and maximum gasoline price per year. Present the price statistics to two decimal places.c. Create a new variable that represents the quarter of the year by applying a user-defined format to the Month variable in a DATA step.