02-14-2018 03:33 AM
Need urgent help to complete the assignment please:
NOTE:Files are attached
a) Import HTWT data set to extract 10 observations starting from fifth observation using SAS macros.
b) Write a macro to compare two numeric values.
(Hint: a) Use proc print. b) Use %if %then %do statement.)
2) Let’s say you have "Revenue" information for different years from 2005 to 2009 with variable revenue. Write SAS macro which will apply means and univariate procedure on each year for revenue variable.
(Hint: Define a macro variable to specify the procedure “name”.)
3) The data set "Macro definition.txt" has two SAS macros definition, import them and apply on HTWT data set.
(Hint: Use %INCLUDE.)
4) Save the macros permanently defined so far and list all the macros.
(Hint: Use options mstored sasmstore then run proc catalog.)
02-14-2018 03:35 AM
Required help to convert the below SAS codes into macros.
a) proc gchart data=HTWT; vbar gender/sumvar=weight; Title "Average weight by Gender";
b) proc plot data=HTWT; Title "Scatter plot"; plot &height*&weight;
(Hint: Define two different macros.)
02-14-2018 04:28 AM
So you have an assignment to do, and you are asking us to do it for you. I don't believe this is the place to be hiring contract workers. As such I would suggest you progress with the assignment as you can and come back with any specific questions you might have.
As a starting point, and an easy way to start with macro is:
1) Learn Base SAS - this is the programming language, it is what is compiled and run, it should be used for data manipulation
2) Write your code first off solely in Base SAS, no macro
3) Once you have a working program, identify repeating parts, or parts that could be parameterised
4) Modify the code to use macros where, and only where, they add value. Writing macro purely for the purpose of writing macro will result in garbage code which falls over every run
When you have done the above many times you will see a lot of it up front, but that is when you should be using software development lifecycle methodology anyways, i.e. documenting everything, inputs, outputs, processes, links etc. So writing the code at that point becomes moot because it is already documented and written down.
A final note, you have the terms in that text, a simple google on "SAS <xyx>" replace xyz with term, will yield the manual and examples.