Question

1. Write a macro in SAS: It should be able to use proc means to print...

1. Write a macro in SAS: It should be able to use proc means to print means of a quantitative variable BY a categorical variable (must use a BY line of code), and use proc sgplot to print boxplots of the same quantitative variable by the categorical. Your macro should sort the data first. The user should be able to call the macro, indicating the data set name, and the two variables used in the analysis, as parameters. (You’ll use the macro on some data below…)

Homework Answers

Answer #1

SOLUTION:

Use % macro to create a macro block

define 3 variables.

use proc sort to sort the dataset by class variable.

perform proc means on dataset and sgplot

SAS CODE:

%macro analysis (vars=,input=,class=);
proc sort data=&input;
by &class;
run;

proc means data=&input n mean min max maxdec=2;
class &class;
var &vars;
run;

proc sgplot data=&input;
hbox &vars / category=&class;
run;
%mend analysis;


%analysis(vars=cholesterol,input=sashelp.heart,class=weight_status) ;#call macro
%analysis(vars=returns,input=sashelp.shoes,class=product) ;

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
IN MIPS ASSEMBLY Macro File: Create macros to print an int, print a char, print a...
IN MIPS ASSEMBLY Macro File: Create macros to print an int, print a char, print a string, get a string from the user, open file, close file, read file, and allocate heap memory. You can use more macros than these if you like. Main Program File: Allocate 1024 bytes of dynamic memory and save the pointer to the area. The main program is a loop in which you ask the user for a filename. If they enter nothing for the...
Question 1: The data table shows the sugar content of a fruit (Sugar) for different numbers...
Question 1: The data table shows the sugar content of a fruit (Sugar) for different numbers of days after picking (Days). Days Sugar 0 7.9 1 12.0 3 9.5 4 11.3 5 11.8 6 10.3 7 4.2 8 0.8 HAND CALCULATIONS: The dependent (Y) variable is sugar content and the independent (X) variable is number of days after picking (Days). Do the following by hand, SHOWING WORK. You may use SAS/R to check your answers if you want. (a) Find...
1. In C++, programmers can use a class to create a large number of instance variables...
1. In C++, programmers can use a class to create a large number of instance variables of the class's type. Group of answer choices True False 2. When a C++ programmer declares a function, they are required to state all of the following except Group of answer choices {} The type of data, if any, returned by the function The function name The type of data, if any, sent to the function 3. When a C++ programmer calls a function,...
Assignment #4 – Student Ranking : In this assignment you are going to write a program...
Assignment #4 – Student Ranking : In this assignment you are going to write a program that ask user number of students in a class and their names. Number of students are limited to 100 maximum. Then, it will ask for 3 test scores of each student. The program will calculate the average of test scores for each student and display with their names. Then, it will sort the averages in descending order and display the sorted list with students’...
In c++ create a class to maintain a GradeBook. The class should allow information on up...
In c++ create a class to maintain a GradeBook. The class should allow information on up to 3 students to be stored. The information for each student should be encapsulated in a Student class and should include the student's last name and up to 5 grades for the student. Note that less than 5 grades may sometimes be stored. Your GradeBook class should at least support operations to add a student record to the end of the book (i.e., the...
program has to be written in X86 processor assy language. Write a program that find the...
program has to be written in X86 processor assy language. Write a program that find the minimum number of coins that can represent an amount of money under $1. The amount of money is a random number between 0 and 99 (cents). The randomRange procedure is used to get a random number. Review the sample code in lab4.asm and run it to see how randomRange works. Each time randomRange is called, it creates a random number between 0 and the...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName (a String), numSold (an integer that represents the number of that type of game sold), and priceEach (a double that is the price of each of that type of Game). I only want three instance variables!! The class should have the following methods: A constructor that has two parameter – a String containing the name of the Game and a double containing its price....
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics...
Topics Arrays Accessing Arrays Description Write a C++ program that will display a number of statistics relating to data supplied by the user. The program will ask the user to enter the number of items making up the data. It will then ask the user to enter data items one by one. It will store the data items in a double array. Then it will perform a number of statistical operations on the data. Finally, it will display a report...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using...
Please do it in Python Write the simplest program that will demonstrate iteration vs recursion using the following guidelines - Write two primary helper functions - one iterative (IsArrayPrimeIter) and one recursive (IsArrayPrimeRecur) - each of which Take the array and its size as input params and return a bool. Print out a message "Entering <function_name>" as the first statement of each function. Perform the code to test whether every element of the array is a Prime number. Print out...
6.2.25 Rising mercury levels due to industrial pollution is a recent concern. Many fish have high...
6.2.25 Rising mercury levels due to industrial pollution is a recent concern. Many fish have high levels of mercury. Data were collected on random samples of tuna from 1991 to 2010 and are available in the file Tuna. Each row in the data set represents the mercury level of a different fish. With randomization techniques we are able to analyze any test statistic we desire. What if we wanted to look at whether there was a difference in the median...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT