BookmarkSubscribeRSS Feed
ccwrich
Calcite | Level 5
  1. Write your name in your program using a common statement.
  2. Use infile statement to read the data set.
  3. Assign a title with the problem number for each problem,
  4. Your output for each problem should contain only what is asked.
  5. Please submit your programs and outputs.



Given Data/Code: From Separate Document

 Employee_id   Name gender   years   dept     salary01 salary02  salary03;

 

                        1 Mitchell, Jane A  f    6     shoe     22,450  23,000  26,600

2 Miller, Frances T  f  8  appliance      .     32,500  33,000

3 Evans, Richard A  m   9  appliance    42,900  43,900  .

4 Fair, Suzanne K  f    3  clothing     29,700  32,900 34,500

5 Meyers, Thomas D  m  5  appliance     33,700  34,400  37,000

6 Rogers, Steven F  m  3    shoe         27,000  27,800  .

7 Anderson, Frank F  m  5  clothing      33,000  35,100  36,000

10 Baxter, David T  m  2     shoe         23,900    .    31,300

11 Wood, Brenda L  f  3     clothing      33,000  34,000  35,700

12 Wheeler, Vickie M  f  7  appliance     31,500  33,200  35,600

13 Hancock, Sharon T  f  1  clothing      21,000   .     22,500

14 Looney, Roger M    m  10 appliance     42,900 36,200 37,800

15 Fry, Marie E     f    6  clothing      29,700 30,500 31,200

Problems:

 

  1. Apply both proc freq and proc chart to show the distribution of years of employment.

.

  1. Apply both proc freq and proc chart to show the number of employees in each department for each gender.

 

  1. Calculate the average of the two highest salaries for employees who have three salaries and average of two salaries if they have only two salaries. Print the names of employees who have the highest average in their department. Also, print their averages, their department names, and the department averages.

 

  1. Obtain a table that shows the average of salary01 for each gender in each department.

 

  1. For each department, use a two-way table to show both the number of employees whose salar01 is above 30,000 and also the number of employees whose salarie01 is not above 30,000.

 

  1. Print the name of employee whose salary01 is the highest among all employees.

 

  1. For each department find the employee whose salary01 is the highest in the department. Print the names of these employees and department names.

I think I have the correct code but I don't understand the infile statement to pull data from another source

1 REPLY 1
Tom
Super User Tom
Super User

Show your code.  Do not attach WORD file.  Just copy and paste the actual text into the window that pops up when you click on the Insert SAS Code button.

 

The wording in the assignment is very imprecise (and hence potentially confusing).

 

I assume the first point is that you should have a COMMENT in your code that has your name.  Like writing your name on your homework or exam paper.

 

You do not use an INFILE statement to read from an existing SAS dataset.  So I assume the second point is talking about using an INFILE statement to point to the source text that will be read as part of a DATA STEP that will create a SAS dataset. 

 

I assume the third point is talking about making sure to include the problem number in the title (or titles) on your OUTPUT.  Again to make it easier for the grader.

 

The text you posted does not look like something that a novice SAS user could read into a dataset.  I assume that its formatting has been destroyed by being pasted into this discussion forum.  That will mess up the formatting since it will try to flow the text into paragraphs.  If you want to share the text of the file then copy the text and paste it into the box that appears when you click on the Insert Code button.

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 272 views
  • 0 likes
  • 2 in conversation