BookmarkSubscribeRSS Feed
Pcecil
Calcite | Level 5
I am enrolled in a SAS course at college and recently we got some problems to do. I do not have the book yet and cannot seem to find information on how to solve the following questions from it. If someone can point me in the right direction until my book comes or show me where i can access beginner SAS info until my book arrives that would be great.

. An experiment was run to study battery life and the data was recorded as shown below. Place the data in the current format after the Datalines; statement in your SAS code:

A Radio 8.6

A Camera 8.2

A DVD 7.9

A Radio 8.4

A Camera 5.4

A DVD 5.7

B Radio 9.4

B Camera 8.8

B DVD 8.5

B Radio 8.9

B Camera 5.8

B DVD 5.9

C Radio 8.5

C Camera 8.6

C DVD 7.8

C Radio 7.6

C Camera 5.1

C DVD 5.4

D Radio 9.1

D Camera 8.8

D DVD 8.9

D Radio 8.7

D Camera 5.8

D DVD 5.6

Write an appropriate Data step to read in the data and using only the “Proc Print” statement function (no formatting statements allowed) to output the data in the following layout shown below:



Battery Radio Camera DVD



A 8.6 8.2 7.9

A 8.4 5.4 5.7

B 9.4 8.8 8.5

B 8.9 5.8 5.9

C 8.5 8.6 7.8

C 7.6 5.1 5.4

D 9.1 8.8 8.9

D 8.7 5.8 5.6



Note that the first row the desired layout consists of variable labels.


and

Import the file diamond.xls into SAS and complete the following tasks:
1. Create a new variable which for the price per carat. Print the 401st to 500th observation in the data set.
2. Print the price by clarity for only colors D and I.
3. Print the price per carat (as produced in Part a) by color, for clarity VS1.
4. Print this data set for only diamonds having clarity ranking of IF.
5. Based on the above, explain how ratings for clarity and color impact the price. What is the best way of printing out the data to explain the impact of color and clarity on price? Explain.

The problem with the above is i cannot seem to change or add variables after i import the .dat file. I know most of the rest.

Thanks,
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
The SAS support website http://support.sas.com/ has much to offer you in SAS-hosted documentation and supplemental technical / reference material.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search arguments, this topic / post:

intro data step programming site:sas.com

data step documentation site:sas.com

elearn site:sas.com

tutorials site:sas.com

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

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
  • 633 views
  • 0 likes
  • 2 in conversation