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
Scenario: Please write a few lines describing your scenario and the four variables (in addition to...
Scenario: Please write a few lines describing your scenario and the four variables (in addition to income) you have selected. Use Table 1 to report the variables selected for this assignment. Note: The information for the required variable, “Income,” has already been completed and can be used as a guide for completing information on the remaining variables. Table 1. Variables Selected for the Analysis Variable Name in the Data Set Description (See the data dictionary for describing the variables.) Type...
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’...
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....
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,...
Java Programming In this lab students continue to write programs using multiple classes. By the end...
Java Programming In this lab students continue to write programs using multiple classes. By the end of this lab, students should be able to Write classes that use arrays and ArrayLists of objects as instance variables Write methods that process arrays and ArrayLists of objects Write getter and setter methods for instance variables Write methods using object parameters and primitive types Question- class StringSet. A StringSet object is given a series of up to 10 String objects. It stores these...
Assignment Overview This programming exercise introduces generics and interfaces. The students must create methods that accept...
Assignment Overview This programming exercise introduces generics and interfaces. The students must create methods that accept generic parameters and perform operation on them. Deliverables A listing of the fully commented, working source code of the Java program Test data for the code A screen shot of the application in execution Step 1 Create a new project. Name it "Assignment_2_1". Step 2 Build a solution. Write the Java source code necessary to build a solution for the problem below:You have just...
Write a code in c++ using linear insertion following the steps below. Comment your work. 1....
Write a code in c++ using linear insertion following the steps below. Comment your work. 1.    Ask the user for the name of a file containing data. If it does not exist, the program should display an error, then ask for a new file name. Entering an asterisk (*) as the first and only character on a line should terminate the program. 2.     You can use a statically-allocated one-dimensional array of doubles for this with length 100. You...
Note: Do not use classes or any variables of type string to complete this assignment Write...
Note: Do not use classes or any variables of type string to complete this assignment Write a program that reads in a sequence of characters entered by the user and terminated by a period ('.'). Your program should allow the user to enter multiple lines of input by pressing the enter key at the end of each line. The program should print out a frequency table, sorted in decreasing order by number of occurences, listing each letter that ocurred along...
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...
In C programming, Thank you Write a program to compute the area of a circle. You...
In C programming, Thank you Write a program to compute the area of a circle. You have to write a complete “C” program that compiles and runs in Codeblocks. Program requirements: 1. Declare the variables needed: radius (r) and area (yourLastName). 2. Calculate and print the area of each circle. 3. The program MUST prompt the user for a new radius (r) over and over until the user types -1. 5. Use the type double for all decimal numbers. 6....
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT