Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

proc sql sas Level 2 Creating a Table by Defining Its Structure and Adding Data

ID: 3701996 • Letter: P

Question

proc sql sas Level 2 Creating a Table by Defining Its Structure and Adding Data a. Create a table named grion.xewards with four columns: 2. . Purchased- a numeric column, formatted to be nine characters wide, including commas and two decimal places . Year- a numeric column, formatted to be four characters wide with no decimal places . Level- a character column, which holds the value Silver, Gold, or Platinum . Award -a character column (maximum of 50 characters) b. Add six rows of data to the grion.rewards table, and then write a query to display the contents of the Rewards table. The results should resemble the following: PROC SQL Output Purchased Year Level Award fi ffffFNfffiififfffiffff 20000 2012 Silver 25% Discount on one item over $25 300.00 2012 Gold 15% Discount on one order over S50 500 00 2012 Platinum 10% Discount on all 2012 purchases 225.00 2013 Silver 25% Discount on one item over $50 35000 2013 Gold 15% Discount on one order over $100 60000 2013 Platinum 10% Discount on all 2013 purchases

Explanation / Answer

You have mentioned the purchased column shoush include commas that's why I'm mamaki it a varchar and not numeric. Other wise ideally it shshou be numeric (9,2).

a.CREATE TABLE orion_rewards

(

Purchased varchar(9),

Year numeric(4),

Level varchar(10) check Level in('Silver' , 'Gold', 'Platinum' ),

Award varchar(50)

);

b.

INSERT INTO orion_rewards VALUES('200.00' ,2012,'Silver', '25% discount on one item over $25' ) ;

INSERT INTO orion_rewards VALUES('300.00',2012, 'Gold','15% discount on one order over $50' );

INSERT INTO orion_rewards VALUES ('500.00', 2012,'Platinum', '10% discount on all 2012 purchases ' );

INSERT INTO orion_rewards VALUES('225.00', 2013,'Silver ', '25% discount on one item over $50' ) ;

INSERT INTO orion_rewards VALUES ('350.00'',2013, 'Gold', '15'% discount on one order over $100' ) ;

INSERT INTO orion_rewards VALUES('650.00',2013, 'Platinum' , '10% discount on all 2013 purchases' ) ;

To display all the records :

SELECT * FROM orion_rewards;