Lesson Quizzes - SAS Programming 2, Data Manipulation Techniques

.pdf
School
Hope College**We aren't endorsed by this school
Course
STATISTICS 125
Subject
Statistics
Date
Dec 20, 2024
Pages
90
Uploaded by ProfFerret4819
SAS®Programming 2: Data Manipulation Techniques Lesson Quizzes
Background image
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are trademarks of their respective companies.SAS®Programming 2: Data Manipulation Techniques – Lesson Quizzes Copyright © 2022 SAS Institute Inc. Cary, NC, USA. All rights reserved. Printed in the United States of America. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS Institute Inc.Course code PG294LQ, prepared date 03Nov2022.PG294LQ_001
Background image
Lesson 1 Lesson Quizzes1.1Quizzes.....................................................................................................................................1-3Lesson 1 – Controlling DATA Step Processing......................................................................1-3Lesson 2 – Summarizing Data...............................................................................................1-8Lesson 3 – Manipulating Data with Functions......................................................................1-13Lesson 4 – Creating Custom Formats..................................................................................1-18Lesson 5 – Combining Tables..............................................................................................1-23Lesson 6 – Processing Repetitive Code..............................................................................1-28Lesson 7 – Restructuring Tables..........................................................................................1-331.2Solutions................................................................................................................................1-38Lesson 1...............................................................................................................................1-38Lesson 2...............................................................................................................................1-46Lesson 3...............................................................................................................................1-53Lesson 4...............................................................................................................................1-59Lesson 5...............................................................................................................................1-65Lesson 6...............................................................................................................................1-74Lesson 7...............................................................................................................................1-79
Background image
1-2Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.
Background image
1.1 Quizzes1-3Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.1.1QuizzesLesson 1 – Controlling DATA Step ProcessingCopyright © SAS Institute Inc. All rights reserved.31.Which statement is false concerning the compilation phase of the DATA step?a.Initial values are assigned to the columns.b.The program data vector (PDV) is created.c.The DATA step is checked for syntax errors.d.The descriptor portion of the output table is created.Copyright © SAS Institute Inc. All rights reserved.52.Which statement is not a compile-time-only statement?a.KEEPb.LENGTHc.SETd.WHERE
Background image
1-4Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.73.Which statement is true concerning the execution phase of the DATA step?a.Data is processed in the program data vector (PDV).b.An implied OUTPUT occurs at the top of the DATA step.c.An implied REINITIALIZE occurs at the bottom of the DATA step.d.Columns read from the input table are set to missing when SAS returns to the top of the DATA step. Copyright © SAS Institute Inc. All rights reserved.94.The DATA step debugger in SAS Enterprise Guide can be used with DATA and PROC steps. a.Trueb.False
Background image
1.1 Quizzes1-5Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.115.Which PUTLOG statements create the following results in the SAS log?a.putlog all; putlog Ratio;b.putlog all; putlog Ratio=;c.putlog _all_; putlog Ratio;d.putlog _all_; putlog Ratio=;Name=Alfred Height=69 Weight=112.5 Ratio=0.61 _ERROR_=0 _N_=1Ratio=0.61Copyright © SAS Institute Inc. All rights reserved.136.How many rows and columns are in the output table ShippingZonesgiven the following information?a.5 rows and 3 columnsb.5 rows and 4 columnsc.10 rows and 3 columnsd.10 rows and 4 columnsdata ShippingZones;set Shipping;Zone=1;output;Zone=2;Rate=(Rate*1.5);run;The input table Shippingcontains 5 rows and 3 columns (Product, BoxSize, and Rate).
Background image
1-6Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.157.Which statement is true given the following information?a.The Other table contains 10 rows.b.The Other table contains 19 rows.c.The Females table contains 10 rows.d.The Females table contains 19 rows.data Females Other;set sashelp.class;if sex='F' then output Females;output Other;run; sashelp.class contains 19 rows: 9 rows with a sex value of Fand 10 rows with a sex value of M.Copyright © SAS Institute Inc. All rights reserved.178.Which statement is false?a.The KEEP statement names the columns to include from the input table.b.The DROP statement names the columns to exclude from the output table.c.The KEEP= option in the DATA statement names the columns to include in the output table. d.The DROP= option in the SET statement names the columns to exclude from being read into the PDV.
Background image
1.1 Quizzes1-7Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.199.Which columns are in the final table work.boots?a.Subsidiaryb.Subsidiary and Totalc.Product and Subsidiaryd.Product, Subsidiary, Sales, and Inventorydata work.boots(drop=Product); set sashelp.shoes(keep=Product Subsidiary Sales Inventory);where Product='Boot';drop Sales Inventory;Total=sum(Sales,Inventory);run;Copyright © SAS Institute Inc. All rights reserved.2110.What is the result of running the following DATA step?a.The step produces work.boots with three columns.b.The step produces work.boots with four columns.c.The step produces an error due to invalid syntax for the KEEP= option.d.The step produces an error because the Sales column is not read in from the sashelp.shoes table.data work.boots; set sashelp.shoes(keep=Product Subsidiary);where Product='Boot';NewSales=Sales*1.25;run;
Background image
1-8Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 2 – Summarizing DataCopyright © SAS Institute Inc. All rights reserved.241.Which statement contains valid syntax for the RETAIN statement?a.retain year 2018; b.retain year*2018; c.retain year=2018;d.retain year{2018}; Copyright © SAS Institute Inc. All rights reserved.262.Which statement is false concerning the sum statement?a.The sum statement ignores missing values.b.The sum statement initially sets the accumulator column to missing.c.The sum statements adds a numeric value to an accumulator column.d.The sum statement automatically retains the value of the accumulating column.
Background image
1.1 Quizzes1-9Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.283.What is the value of Count at the end of the third DATA step iteration?a.. (missing)b.60c.130d.160work.numsdata newnums;set nums;retain Count 100; Count+Tens;run;Copyright © SAS Institute Inc. All rights reserved.304.What is the value of Count at the end of the third DATA step iteration?a.. (missing)b.20c.30d.70work.numsdata newnums;set nums;Count+Tens;run;
Background image
1-10Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.325.Which step executes successfully without an error, given the input table sashelp.class?a.b.c. d.data new;set sashelp.class;Ratio=Height/Weight;where Sex='M' & Ratio>0.6;run;data new;set sashelp.class;where Sex='M’;Ratio=Height/Weight;if Ratio>0.6;run;data new;set sashelp.class;where Sex='M'; Ratio=Height/Weight;where Ratio>0.6;run;data new;set sashelp.class;if Sex='M’;Ratio=Height/Weight;where Ratio>0.6;run;Copyright © SAS Institute Inc. All rights reserved.346.Which statement is true given the following program?a.The PDV contains a temporary variable named First.Name.b.The output table work.student contains a column named Last.Name.c.The DATA step sorts the input table by the column Name.d.An error is produced because the BY statement is not permitted in the DATA step.data work.student;set sashelp.class;by Name;run;
Background image
1.1 Quizzes1-11Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.367.What are the correct values for First.Name and Last.Name if the value of Name appears only once in the input table?a.First.Name=0 and Last.Name=0b.First.Name=1 and Last.Name=1c.First.Name=1 and Last.Name=0d.First.Name=0 and Last.Name=1data work.student;set sashelp.class;by Name;run;Copyright © SAS Institute Inc. All rights reserved.388.Which DATA step statement indicates to continue processing the last row of a BY group?a.if First.JobTitle;b.if Last.JobTitle;c.where First.JobTitle=1;d.where Last.JobTitle=1;
Background image
1-12Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.409.Which statement needs to be added to the DATA step to reset the value of TotalWt for each new BY group?a.TotalWt=0;b.if Last.Gender=0 then TotalWt=0;c.if First.Gender=0 then TotalWt=0;d.if First.Gender=1 then TotalWt=0;data GenderWeight;set Students;by Gender;add statement here …TotalWt+Weight;if Last.Gender=1 then output;run;Copyright © SAS Institute Inc. All rights reserved.4210.What are the values for First.City and Last.City for the third row of the input table given the following information?a.First.City=0 and Last.City=0b.First.City=1 and Last.City=0c.First.City=0 and Last.City=1d.First.City=1 and Last.City=1data StatePopulation;set Population;by State City;run;
Background image
1.1 Quizzes1-13Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 3 – Manipulating Data with FunctionsCopyright © SAS Institute Inc. All rights reserved.451.Functions and CALL routines both return a value that must be used in an assignment statement or expression.a.Trueb.FalseCopyright © SAS Institute Inc. All rights reserved.472.Which function calculates the average of the columns Week1, Week2, Week3, and Week4?a.mean(Week1, Week4)b. mean(Week1-Week4)c.mean(of Week1, Week4)d.mean(of Week1-Week4)
Background image
1-14Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.493.Which expression rounds each value of Sales to the nearest hundredth (or two decimal places)?a.round(Sales)b.round(Sales, 2)c.round(Sales, .01)d.round(Sales, dollar10.2)Copyright © SAS Institute Inc. All rights reserved.514.Which function could be used to remove the non-numeric symbols in Phone?a.COMPRESSb. COMPBLc.SCANd. FINDPhone 202-555-0190202.555.0110(202)555-0133[202]555-0128
Background image
1.1 Quizzes1-15Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.535.Which statement reads CityCountry and correctly assigns a value to Country? a.Country=scan(CityCountry, 2);b.Country=scan(CityCountry, -1);c.Country=scan(CityCountry, 2, ',');d.Country=scan(CityCountry, 2, ', ');CityCountryCountryAthens, Greece GreeceNew Delhi, IndiaIndiaAuckland, New ZealandNew ZealandCopyright © SAS Institute Inc. All rights reserved.556.Which expression creates CityCountry?a.cat(City, ", ", Country)b.cats(", ", City, Country)c.catx(City, ", ", Country)d. catx(", ", City, Country)CityCountryCityCountryAthensGreeceAthens, Greece New DelhiIndiaNew Delhi, IndiaAucklandNew ZealandAuckland, New Zealand
Background image
1-16Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.577.How many rows are written to output based on the following statement? a.0b. 1c.3d. 5LocationHonolulu, OahuKaanapali, MauiHilo, Hawaiikailua, oahuLAIE, OAHUif find(Location, "Oahu", "i") > 0 then output;Copyright © SAS Institute Inc. All rights reserved.598.Which of the following functions can convert the values of the numeric variable Level to character values? a.put(Level, 3.)b.put(3., Level)c.input(3., Level)d.input(Level, 3.)
Background image
1.1 Quizzes1-17Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.619.Which of the following functions converts the character values of Base to numeric values?a.put(comma10.2, Base)b.put(Base, comma10.2)c.input(Base, comma10.2)d.input(comma10.2, Base)Copyright © SAS Institute Inc. All rights reserved.6310.Which step is not required when converting a character column named Date to a numeric SAS date column with the same name? a.Rename the Date column to a new name, such as CharDate.b.Use the INPUT function to read the renamed CharDate character column and create a numeric column named Date.c.Specify an appropriate informat in the INPUT function. d.Format the new numeric Date column.
Background image
1-18Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 4 – Creating Custom FormatsCopyright © SAS Institute Inc. All rights reserved.661.Which of the following contains valid syntax?a..b..c..value grades 'A'='Excellent' 'B'='Good';value qtrfmt 1,2,3='First' 4,5,6='Second';value $grades. 'A'='Excellent' 'B'='Good';value qtrfmt '1'-'3'='First' '4'-'6'='Second';Copyright © SAS Institute Inc. All rights reserved.682.What is the formatted value for the value of 100 given the following step?a.lowb.mediumc.highd.out of rangeproc format;value rates 1-<100='low'100<-<200='medium'200-300 ='high'other ='out of range';run;
Background image
1.1 Quizzes1-19Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.703.In the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format.a.Trueb.FalseCopyright © SAS Institute Inc. All rights reserved.724.What is the correct formatted output given the following PROC FORMAT step and the input table?a.b. c. d.proc format;value $answer '1'='Yes''2'='No''other'='Not Answered';run;
Background image
1-20Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.745.Which one of the following does not have proper syntax for specifying a range in the VALUE statement?a.500>-700b.500-<700c.'A'-'C'd.'Horse'-'Mouse'Copyright © SAS Institute Inc. All rights reserved.766.Which statement is true concerning options for the FORMAT procedure?a.The FMTLIB option goes in the SELECT statement.b.The CNTLIN= option goes in the VALUE statement. c.The FMTLIB option specifies the library to store the format.d.The CNTLIN= option specifies a table from which formats are built.
Background image
1.1 Quizzes1-21Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.787.Which columns are required in an input table to create a format based on numeric ranges?a.FMTNAME, START, and LABELb.FORMAT, START, END, and NAME c.FMTNAME, START, END, and LABEL d.FORMAT, START, LAST, NAME, and TYPECopyright © SAS Institute Inc. All rights reserved.808.Which option in the PROC FORMAT statement specifies a library to store a custom format?a.CATALOG=b.FMTLIB=c.LIBRARY=d.STORE=
Background image
1-22Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.829.What is the default search order that is used to locate formats?a.LIBRARY.FORMATS WORK.FORMATSb.SASHELP.FORMATS LIBRARY.FORMATSc.SASHELP.FORMATS WORK.FORMATSd.WORK.FORMATS LIBRARY.FORMATSCopyright © SAS Institute Inc. All rights reserved.8410.Which of the following contains valid syntax for the FMTSEARCH= option?a.options fmtsearch=sashelp;b.options fmtsearch=sashelp.formats;c.options fmtsearch=(sashelp sashelp.fmts);d.options fmtsearch=[sashelp.fmts sashelp];
Background image
1.1 Quizzes1-23Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 5 – Combining TablesCopyright © SAS Institute Inc. All rights reserved.871.Which statement is true concerning concatenating tables?a.All tables must have the same number of columns.b.Columns in all tables must have matching names and lengths.c.Tables must be in the same library.d.Missing values are generated for columns that exist in one input table and not in another.Copyright © SAS Institute Inc. All rights reserved.892.Which statement renames the existing column Location in work.travelas Destination? a.b.c.d.Aset vacations travel(rename=(Location=Destination)); set vacations(rename=(Location=Destination)) travel; set vacations travel(rename=(Destination=Location)); set vacations travel(rename(Destination=Location));
Background image
1-24Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.913.Which statement is true concerning merging with matching rows?a.The MERGE statement must refer to temporary input tables.b.The columns in the BY statement can be in only one of the tables.c.Only two input tables can be specified in the MERGE statement.d.The input tables must be sorted by the columns in the BY statement.Copyright © SAS Institute Inc. All rights reserved.934.How many rows are in the output table given the following?a.twob.threec.fourd.fivedata both;merge agetable foodtable;by Name;run;work.agetablework.foodtable
Background image
1.1 Quizzes1-25Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.955.How many rows are in the output table given the following?a.twob.threec.fourd.fivedata empsauc;merge empsau phonec;by EmpID;run;work.empsauwork.phonecCopyright © SAS Institute Inc. All rights reserved.976.What is the result of the following step?a.The table combine is created with four columns and five rows.b.The step fails because the BY column ID is not properly sorted.c.The step fails because Units is in both tables and not the BY column.d.The step fails because of duplicate ID values within the donors1 table.data combine;merge donors1 donors2;by ID;run;work.donors1work.donors2
Background image
1-26Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.997.Which statement best describes the rows in the output table?a.all the matching rows from both managers and staffb.only the rows from managers that have no match in staffc.only the rows from staff that have no match in managersd.all the matching and nonmatching rows from both managers and staffdata bonuses;merge managers(in=M)staff(in=S);by EmpID;if M=0 and S=1;run;Copyright © SAS Institute Inc. All rights reserved.1018.What are the values of C and A during the third iteration of the DATA step?a.C=0 and A=0b.C=1 and A=0c.C=0 and A=1d.C=1 and A=1data client_amount;merge clients(in=C) amounts(in=A);by Name;run;work.clientswork.amounts
Background image
1.1 Quizzes1-27Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1039.What is the value of Location in the output table?a.Italyb.Francec.Belgiumd.France Belgium Italydata locALL;merge loc1 loc2 loc3;by Code;run;loc1CodeLocationAFranceloc2CodeLocationABelgiumloc3CodeLocationAItalyCopyright © SAS Institute Inc. All rights reserved.10510.A single DATA step can be used to merge the following three tables:a.Trueb.Falsedataset1StudentTestScoredataset2SubjectTestdataset3SubjectAvgScore
Background image
1-28Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 6 – Processing Repetitive CodeCopyright © SAS Institute Inc. All rights reserved.1081.Which output table is produced from the following step?a.b.c. d.data Earnings(keep=Qtr Earned);Amount=1000; Rate=.075/4;do Qtr=1 to 4;Earned+(Amount+Earned)*Rate;end;run;Copyright © SAS Institute Inc. All rights reserved.1102.Which statement is true regarding the iterative DO loop?a.The start and stop values can be character or numeric values.b.If an increment value is not specified, the default increment is 0.c.The index column is incremented at the bottom of each DO loop. d.The index column is not in the final table unless specifically kept.DOindex-column=startTOstop<BYincrement> ;
Background image
1.1 Quizzes1-29Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1123.How many rows are in the output table given the following?a.1b.4c.5d.20data work.savings;set pg2.savings;Savings=0;do Year=1 to 5;do qtr=1 to 4;Savings+Amount;Savings+(Savings*0.02/12);end;end;run;pg2.savingsCopyright © SAS Institute Inc. All rights reserved.1144.What is the final value of Year given the following step?a.. (missing)b.2010c.2019d.2020data invest;do Year=2010 to 2019;Capital+5000;Capital+(Capital*.03);end;run;
Background image
1-30Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1165.Which of the following statements contains valid syntax?a.do 1 to 10 by 2;b.do while (Year>2025);c.do until Earnings<=100000;d.do date='01JAN2019' to '31JAN2019';Copyright © SAS Institute Inc. All rights reserved.1186.How many rows are in the output table given the following?a.2b.3c.6d.12e.24data bikeinfo2;set bikeinfo;do month=1 to 3;do week=1 to 4;bike=bike+2;end;output;end;run;work.bikeinfo
Background image
1.1 Quizzes1-31Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1207.What is the value of x at the completion of the DATA step?a.. (missing)b.13c.15d.16data test;x=15;do until(x>12);x+1;end;run;Copyright © SAS Institute Inc. All rights reserved.1228.Which statement is false?a.The DO UNTIL loop executes until a condition is true.b.The DO WHILE loop always executes at least one time.c.The DO WHILE loop checks the condition at the top of the loop.d.The DO UNTIL loop checks the condition at the bottom of the loop.
Background image
1-32Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1249.Which of the following statements contains valid syntax?a.do Age=10 to 14 and while (Weight<150);b.do week=1 to 52 do until (Mileage ge 2750);c.do Increase=5 to 10 while (temperature lt 102);d.do Year=2018 to 2028 or until (Earnings<=100000);Copyright © SAS Institute Inc. All rights reserved.12610.Which output table is produced from the following step?a.b.c. d.data test;bike=10;do day=1 to 7 while (bike lt 13);bike=bike+2;end;run;
Background image
1.1 Quizzes1-33Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 7 – Restructuring TablesCopyright © SAS Institute Inc. All rights reserved.1291.Which is the better description for the following table?a.wide tableb.narrow tableCopyright © SAS Institute Inc. All rights reserved.1312.Which statement is needed for creating multiple rows from a single row when using the DATA step to go from a wide to a narrow table?a.WIDEb.NARROWc.RETAINd.OUTPUT
Background image
1-34Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1333.How many rows will be in the final table if work.airwide contains three rows?a.3b.6c.9d.12data work.airnarrow;set work.airwide;Month='Jan';Air=Jan;output;Month='Feb';Air=Feb;output;Month='Mar';Air=Mar;output;keep Year Month Air;run;Copyright © SAS Institute Inc. All rights reserved.1354.When using the DATA step to go from a narrow table to a wide table, the KEEP statement is needed to hold values in the PDV across multiple iterations of the DATA step. a.Trueb.False
Background image
1.1 Quizzes1-35Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1375.Which statement needs to be added to the DATA step to include only the last row per Year in the output table?a.output;b.if Last then output;c.if Last.Year=1 then output;d.if Last.Year=0 then output;data work.airwide2(keep=Year Jan Feb Mar);set work.airnarrow;by Year;retain Jan Feb Mar;if Month='Jan' then Jan=Air;else if Month='Feb' then Feb=Air;else if Month='Mar' then Mar=Air;... insert statement here...run;Copyright © SAS Institute Inc. All rights reserved.1396.Which statement is false concerning the TRANSPOSE procedure? a.Columns are transposed into rows.b.By default, numeric columns are transposed.c.Use a BY statement to sort the data while transposing.d.Use a VAR statement to specifically specify the character and numeric columns to transpose.
Background image
1-36Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1417.Which statements are needed in a PROC TRANSPOSE step for the following example (narrow wide)?a.b.c. d.by Day;id Food;var Meal;by Day;var Meal Food;id Day;var Food Meal;by Day;id Meal;var Food;Copyright © SAS Institute Inc. All rights reserved.1438.Which statement or statements are needed in a PROC TRANSPOSE step for the following example (wide narrow)?a.b.c. d.id Day;by Day;var Breakfast Lunch Dinner;id Day;var Breakfast Lunch Dinner;
Background image
1.1 Quizzes1-37Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Copyright © SAS Institute Inc. All rights reserved.1459.Which option is needed in the PROC TRANSPOSE statement to rename the _NAME_ column?a._name_=Mealb.name=Mealc.prefix=Meald.rename=MealCopyright © SAS Institute Inc. All rights reserved.14710.Which option is needed in the PROC TRANSPOSE statement to rename the COL columns?a.out=meals2(COL1=Day_7 COL2=Day_1)b.out=meals2(name=(COL1=Day_7 COL2=Day_1))c.out=meals2(rename=(COL1=Day_7 COL2=Day_1))d.out=meals2(prefix=(COL1=Day_7 COL2=Day_1))
Background image
1-38Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.1.2SolutionsLesson 1Initial values are assigned to columns at the beginning of the execution phase.Copyright © SAS Institute Inc. All rights reserved.41.Which statement is false concerning the compilation phase of the DATA step?a.Initial values are assigned to the columns.b.The program data vector (PDV) is created.c.The DATA step is checked for syntax errors.d.The descriptor portion of the output table is created.
Background image
1.2 Solutions1-39Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.At execution time, the SET statement is processed to read data into the PDV. The compile-time statements of KEEP, LENGTH, and WHERE are not processed at execution time. The rules of these statements are processed in the compilation phase so that their impact will be observed in the output table.During execution, data manipulation occurs in the PDV. An implied OUTPUT and RETURN (not REINITIALIZE) occurs at the bottom of the DATA step. When SAS returns to the top of the DATA step, columns read from the input table are retained and computed columns are set to missing.Copyright © SAS Institute Inc. All rights reserved.62.Which statement is not a compile-time-only statement?a.KEEPb.LENGTHc.SETd.WHERECopyright © SAS Institute Inc. All rights reserved.83.Which statement is true concerning the execution phase of the DATA step?a.Data is processed in the program data vector (PDV).b.An implied OUTPUT occurs at the top of the DATA step.c.An implied REINITIALIZE occurs at the bottom of the DATA step.d.Columns read from the input table are set to missing when SAS returns to the top of the DATA step.
Background image
1-40Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The Data step debugger in SAS Enterprise Guide works only with DATA steps.Copyright © SAS Institute Inc. All rights reserved.104.The DATA step debugger in SAS Enterprise Guide can be used with DATA and PROC steps. a.Trueb.False
Background image
1.2 Solutions1-41Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED._ALL_ is a keyword to show all of the contents of the PDV. Ratio= writes out the column name, an equal sign, and the value of Ratio. Ratio writes out only the value.data new; set sashelp.class(keep=Name Height Weight); Ratio=round(Height/Weight,.01); putlog all; putlog Ratio=; run; Copyright © SAS Institute Inc. All rights reserved.125.Which PUTLOG statements create the following results in the SAS log?a.putlog all; putlog Ratio;b.putlog all; putlog Ratio=;c.putlog _all_; putlog Ratio;d.putlog _all_; putlog Ratio=;Name=Alfred Height=69 Weight=112.5 Ratio=0.61 _ERROR_=0 _N_=1Ratio=0.61
Background image
1-42Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The explicit OUTPUT statement is sending the ZONE=1 rows to the output table. There is no explicit OUTPUT statement after ZONE=2, so those rows are not making it to the output table. An implicit OUTPUT is not at the bottom of the DATA step due to the explicit OUTPUT. The four columns are Product, BoxSize, Rate, and Zone.Note:There were 5 observations read from the data set WORK.SHIPPING.Note:The data set WORK.SHIPPINGZONES has 5 observations and 4 variables.data Shipping; input Product $ BoxSize Rate; datalines; A 5 10 B 6 11 C 7 12 D 8 13 E 9 13 ; data ShippingZones; set Shipping; Zone=1; output; Zone=2; Rate=(Rate*1.5); run; Copyright © SAS Institute Inc. All rights reserved.146.How many rows and columns are in the output table ShippingZonesgiven the following information?a.5 rows and 3 columnsb.5 rows and 4 columnsc.10 rows and 3 columnsd.10 rows and 4 columnsdata ShippingZones;set Shipping;Zone=1;output;Zone=2;Rate=(Rate*1.5);run;The input table Shippingcontains 5 rows and 3 columns (Product, BoxSize, and Rate).
Background image
1.2 Solutions1-43Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The Females table will contain 9 rows and the Other table will contain 19 rows.The KEEP statement controls which columns are in the output table.Copyright © SAS Institute Inc. All rights reserved.167.Which statement is true given the following information?a.The Other table contains 10 rows.b.The Other table contains 19 rows.c.The Females table contains 10 rows.d.The Females table contains 19 rows.data Females Other;set sashelp.class;if sex='F' then output Females;output Other;run; sashelp.class contains 19 rows: 9 rows with a sex value of Fand 10 rows with a sex value of M.Copyright © SAS Institute Inc. All rights reserved.188.Which statement is false?a.The KEEP statement names the columns to include from the input table.b.The DROP statement names the columns to exclude from the output table.c.The KEEP= option in the DATA statement names the columns to include in the output table. d.The DROP= option in the SET statement names the columns to exclude from being read into the PDV.
Background image
1-44Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The column Subsidiary from the input table and the calculated column Total are in the final table. Product, Sales, and Inventory are dropped. Note:The data set WORK.BOOTS has 52 observations and 2 variables.Copyright © SAS Institute Inc. All rights reserved.209.Which columns are in the final table work.boots?a.Subsidiaryb.Subsidiary and Totalc.Product and Subsidiaryd.Product, Subsidiary, Sales, and Inventorydata work.boots(drop=Product); set sashelp.shoes(keep=Product Subsidiary Sales Inventory);where Product='Boot';drop Sales Inventory;Total=sum(Sales,Inventory);run;
Background image
1.2 Solutions1-45Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.work.boots is created with the columns of Product, Subsidiary, NewSales, and Sales. The values of NewSales and Sales are missing. Sales is uninitialized because the value was not read in from the input table.Note:Variable Sales is uninitialized.Note:Missing values were generated as a result of performing an operation on missing values.Note:There were 52 observations read from the data set SASHELP.SHOES.WHERE Product='Boot';Note:The data set WORK.BOOTS has 52 observations and 4 variables.Copyright © SAS Institute Inc. All rights reserved.2210.What is the result of running the following DATA step?a.The step produces work.boots with three columns.b.The step produces work.boots with four columns.c.The step produces an error due to invalid syntax for the KEEP= option.d.The step produces an error because the Sales column is not read in from the sashelp.shoes table.data work.boots; set sashelp.shoes(keep=Product Subsidiary);where Product='Boot';NewSales=Sales*1.25;run;
Background image
1-46Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 2Yearis the column to retain with an initial value of 2018. A space goes between the retain column and the initial value.The sum statement ignores missing values, initially sets the accumulator column to 0, adds a numeric value to an accumulator column, and automatically retains the value of the accumulator column.Copyright © SAS Institute Inc. All rights reserved.251.Which statement contains valid syntax for the RETAIN statement?a.retain year 2018; b.retain year*2018; c.retain year=2018;d.retain year{2018}; Copyright © SAS Institute Inc. All rights reserved.272.Which statement is false concerning the sum statement?a.The sum statement ignores missing values.b.The sum statement initially sets the accumulator column to missing.c.The sum statements adds a numeric value to an accumulator column.d.The sum statement automatically retains the value of the accumulating column.
Background image
1.2 Solutions1-47Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The initial value of Countis 100. The end of the first iteration is 100+10=110. The end of the second iteration is 110+20=130. The end of the third iteration is 130+30=160. data nums; input Tens; datalines; 10 20 30 40 ; run; data newnums; set nums; retain Count 100; Count+Tens; run; Copyright © SAS Institute Inc. All rights reserved.293.What is the value of Count at the end of the third DATA step iteration?a.. (missing)b.60c.130d.160work.numsdata newnums;set nums;retain Count 100; Count+Tens;run;
Background image
1-48Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The initial value of Countis 0. The end of the first iteration is 0+10=10. The end of the second iteration is 10+20=30. The end of the third iteration is 30+.=30. The sum statement ignores missing values. data nums; input Tens; datalines; 10 20 . 40 ; run; data newnums; set nums; retain Count 100; Count+Tens; run; Copyright © SAS Institute Inc. All rights reserved.314.What is the value of Count at the end of the third DATA step iteration?a.. (missing)b.20c.30d.70work.numsdata newnums;set nums;Count+Tens;run;
Background image
1.2 Solutions1-49Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The WHERE statement subsets data as it is being read into the PDV. Ratiois not in the input table, so Ratiocannot be specified in the WHERE statement. To subset Ratio, the condition must be specified in an IF statement.The BY statement produces the columns First.Name and Last.Name in the PDV, assuming the input table is sorted by Name. These columns will not be in the output table.Copyright © SAS Institute Inc. All rights reserved.335.Which step executes successfully without an error, given the input table sashelp.class?a.b.c. d.data new;set sashelp.class;Ratio=Height/Weight;where Sex='M' & Ratio>0.6;run;data new;set sashelp.class;where Sex='M’;Ratio=Height/Weight;if Ratio>0.6;run;data new;set sashelp.class;where Sex='M'; Ratio=Height/Weight;where Ratio>0.6;run;data new;set sashelp.class;if Sex='M’;Ratio=Height/Weight;where Ratio>0.6;run;Copyright © SAS Institute Inc. All rights reserved.356.Which statement is true given the following program?a.The PDV contains a temporary variable named First.Name.b.The output table work.student contains a column named Last.Name.c.The DATA step sorts the input table by the column Name.d.An error is produced because the BY statement is not permitted in the DATA step.data work.student;set sashelp.class;by Name;run;
Background image
1-50Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.If First.Nameand Last.Nameare both equal to 1, the Namevalue is unique to that row. It is the first time and the last time that the Namevalue appears.This statement is true if Last.Jobtitle is equal to a nonzero or nonmissing value. Therefore, this statement is true when Last.Jobtitle is equal to 1. Copyright © SAS Institute Inc. All rights reserved.377.What are the correct values for First.Name and Last.Name if the value of Name appears only once in the input table?a.First.Name=0 and Last.Name=0b.First.Name=1 and Last.Name=1c.First.Name=1 and Last.Name=0d.First.Name=0 and Last.Name=1data work.student;set sashelp.class;by Name;run;Copyright © SAS Institute Inc. All rights reserved.398.Which DATA step statement indicates to continue processing the last row of a BY group?a.if First.JobTitle;b.if Last.JobTitle;c.where First.JobTitle=1;d.where Last.JobTitle=1;
Background image
1.2 Solutions1-51Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.First.Gender=1represents the beginning of each new BY group. When First.Genderis equal to 1, the value of the accumulator column needs to be set to 0.proc sort data=sashelp.class out=students(rename=(Sex=Gender)); by Sex; run; data GenderWeight; set Students; by Gender; if First.Gender=1 then TotalWt=0; TotalWt+Weight; if Last.Gender=1 then output; run; Copyright © SAS Institute Inc. All rights reserved.419.Which statement needs to be added to the DATA step to reset the value of TotalWt for each new BY group?a.TotalWt=0;b.if Last.Gender=0 then TotalWt=0;c.if First.Gender=0 then TotalWt=0;d.if First.Gender=1 then TotalWt=0;data GenderWeight;set Students;by Gender;add statement here …TotalWt+Weight;if Last.Gender=1 then output;run;
Background image
1-52Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The values of First.Cityand Last.Cityare dependent on the values of State. For the third row, First.Cityis equal to 1 because that is the first time that Greenville appears within NC. Last.Cityis equal to 1 because that is the last time Greenville appears within NC.State=NC City=Cary Population=162320 FIRST.State=1 LAST.State=0 FIRST.City=1 LAST.City=1 _ERROR_=0 _N_=1State=NC City=Durham Population=263016 FIRST.State=0 LAST.State=0 FIRST.City=1 LAST.City=1 _ERROR_=0 _N_=2State=NC City=Greenville Population=91495 FIRST.State=0 LAST.State=1 FIRST.City=1 LAST.City=1 _ERROR_=0 _N_=3State=SC City=Greenville Population=67453 FIRST.State=1 LAST.State=0 FIRST.City=1 LAST.City=1 _ERROR_=0 _N_=4State=SC City=Sumter Population=40723 FIRST.State=0 LAST.State=1 FIRST.City=1 LAST.City=1 _ERROR_=0 _N_=5Copyright © SAS Institute Inc. All rights reserved.4310.What are the values for First.City and Last.City for the third row of the input table given the following information?a.First.City=0 and Last.City=0b.First.City=1 and Last.City=0c.First.City=0 and Last.City=1d.First.City=1 and Last.City=1data StatePopulation;set Population;by State City;run;
Background image
1.2 Solutions1-53Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.data Population; input State $ City $11. Population; datalines; NC Cary 162320 NC Durham 263016 NC Greenville 91495 SC Greenville 67453 SC Sumter 40723 ; run; data StatePopulation; set Population; by State City; put _all_; run; Lesson 3A function returns a value that must be used in an assignment statement or expression, but a CALL routine alters existing column values or performs other system functions.Copyright © SAS Institute Inc. All rights reserved.461.Functions and CALL routines both return a value that must be used in an assignment statement or expression.a.Trueb.False
Background image
1-54Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Numeric column lists are specified with a hyphen between the first and last columns in the range. The keyword OF must be used if a column list is used as an argument in a function.Use the second argument in the ROUND function to specify the rounding unit.Copyright © SAS Institute Inc. All rights reserved.482.Which function calculates the average of the columns Week1, Week2, Week3, and Week4?a.mean(Week1, Week4)b. mean(Week1-Week4)c.mean(of Week1, Week4)d.mean(of Week1-Week4)Copyright © SAS Institute Inc. All rights reserved.503.Which expression rounds each value of Sales to the nearest hundredth (or two decimal places)?a.round(Sales)b.round(Sales, 2)c.round(Sales, .01)d.round(Sales, dollar10.2)
Background image
1.2 Solutions1-55Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The second argument of the COMPRESS function can be used to specify all symbols to remove from the values of Phone. The optional third argument of COMPRESS could further simplify this code by working with entire character classes instead of having to specify individual characters. For example, the ‘d’ modifier specifies only digits, and the ‘k’ modifier instructs COMPRESS to keep the specified items instead of removing them. So specifying ‘kd’ for the third argument causes COMPRESS to keep only digits.The SCAN function should return the second word using only the comma as a delimiter.Copyright © SAS Institute Inc. All rights reserved.524.Which function could be used to remove the non-numeric symbols in Phone?a.COMPRESSb. COMPBLc.SCANd. FINDorPhone 202-555-0190202.555.0110(202)555-0133[202]555-0128Phone=compress(Phone, '-.()[] ');Phone=compress(Phone,,'kd');Copyright © SAS Institute Inc. All rights reserved.545.Which statement reads CityCountry and correctly assigns a value to Country? a.Country=scan(CityCountry, 2);b.Country=scan(CityCountry, -1);c.Country=scan(CityCountry, 2, ',');d.Country=scan(CityCountry, 2, ', ');CityCountryCountryAthens, Greece GreeceNew Delhi, IndiaIndiaAuckland, New ZealandNew Zealand
Background image
1-56Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The CATX function concatenates strings together, removes leading and training blanks, and inserts the separator that is defined as the first argument.The “I” modifier as the third argument in the FIND function makes the search case insensitive. Copyright © SAS Institute Inc. All rights reserved.566.Which expression creates CityCountry?a.cat(City, ", ", Country)b.cats(", ", City, Country)c.catx(City, ", ", Country)d. catx(", ", City, Country)CityCountryCityCountryAthensGreeceAthens, Greece New DelhiIndiaNew Delhi, IndiaAucklandNew ZealandAuckland, New ZealandCopyright © SAS Institute Inc. All rights reserved.587.How many rows are written to output based on the following statement? a.0b. 1c.3d. 5LocationHonolulu, OahuKaanapali, MauiHilo, Hawaiikailua, oahuLAIE, OAHUif find(Location, "Oahu", "i") > 0 then output;
Background image
1.2 Solutions1-57Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The PUT function explicitly converts numeric values to character values. You specify the keyword PUT followed by the variable name and then the format. The variable name and format are enclosed in parentheses and separated by a comma.The INPUT function explicitly converts character values to numeric values. You specify the keyword INPUT followed by the variable name and then the informat. The variable name and informat are enclosed in parentheses and separated by a comma. A numeric informat is needed for character-to-numeric conversions.Copyright © SAS Institute Inc. All rights reserved.608.Which of the following functions can convert the values of the numeric variable Level to character values? a.put(Level, 3.)b.put(3., Level)c.input(3., Level)d.input(Level, 3.)Copyright © SAS Institute Inc. All rights reserved.629.Which of the following functions converts the character values of Base to numeric values?a.put(comma10.2, Base)b.put(Base, comma10.2)c.input(Base, comma10.2)d.input(comma10.2, Base)
Background image
1-58Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Formatting the new column is not required but is recommended.Copyright © SAS Institute Inc. All rights reserved.6410.Which step is not required when converting a character column named Date to a numeric SAS date column with the same name? a.Rename the Date column to a new name, such as CharDate.b.Use the INPUT function to read the renamed CharDate character column and create a numeric column named Date.c.Specify an appropriate informat in the INPUT function. d.Format the new numeric Date column.
Background image
1.2 Solutions1-59Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 4This VALUE statement is creating a numeric format and numeric values are specified.a. This VALUE statement is creating a numeric format but character values are specified.ERROR: The quoted string 'A' is not acceptable to a numeric format or informat.c. This VALUE statement contains a period in the format name.ERROR 22-322: Syntax error, expecting one of the following: a name, $.ERROR 200-322: The symbol is not recognized and will be ignoredd. This VALUE statement is creating a numeric format but character values are specified.ERROR: The quoted string '1' is not acceptable to a numeric format or informat.Copyright © SAS Institute Inc. All rights reserved.671.Which of the following contains valid syntax?a..b..c..value grades 'A'='Excellent' 'B'='Good';value qtrfmt 1,2,3='First' 4,5,6='Second';value $grades. 'A'='Excellent' 'B'='Good';value qtrfmt '1'-'3'='First' '4'-'6'='Second';
Background image
1-60Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.100 falls into the OTHER category. 1-<100 is less than 100. 100<-<200 is greater than 100.The format name is specified in the VALUE statement of PROC FORMAT. However, PROC FORMAT has no reference to the table or column to be formatted. Those items appear in other steps such as a FORMAT statement within PROC PRINT.Copyright © SAS Institute Inc. All rights reserved.692.What is the formatted value for the value of 100 given the following step?a.lowb.mediumc.highd.out of rangeproc format;value rates 1-<100='low'100<-<200='medium'200-300 ='high'other ='out of range';run;Copyright © SAS Institute Inc. All rights reserved.713.In the FORMAT procedure, you specify the name of the format and the name of the column that will use the custom format.a.Trueb.False
Background image
1.2 Solutions1-61Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The word OTHER is in quotation marks. Therefore, it is not seen as a keyword. A value of 3 is not referenced by any of the values in the VALUE statement. The value 3 will be displayed as 3.proc format; value $answer '1'='Yes' '2'='No' 'other'='Not Answered'; run; data new; input Code $; datalines; 1 2 3 ; run; proc print data=new noobs; format Code $answer.; run; Copyright © SAS Institute Inc. All rights reserved.734.What is the correct formatted output given the following PROC FORMAT step and the input table?a.b. c. d.proc format;value $answer '1'='Yes''2'='No''other'='Not Answered';run;
Background image
1-62Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The greater than symbol is not valid for a range. The less than symbol can be used after the starting value or before the ending value.CNTLIN= specifies the table to read in order to create a format. This option goes in the PROC FORMAT statement. The FMTLIB option goes in the PROC FORMAT statement and creates a report containing information about your custom formats.Copyright © SAS Institute Inc. All rights reserved.755.Which one of the following does not have proper syntax for specifying a range in the VALUE statement?a.500>-700b.500-<700c.'A'-'C'd.'Horse'-'Mouse'Copyright © SAS Institute Inc. All rights reserved.776.Which statement is true concerning options for the FORMAT procedure?a.The FMTLIB option goes in the SELECT statement.b.The CNTLIN= option goes in the VALUE statement. c.The FMTLIB option specifies the library to store the format.d.The CNTLIN= option specifies a table from which formats are built.
Background image
1.2 Solutions1-63Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.At a minimum, FMTNAME, START, and LABEL are required for a CNTLIN= table. END is also needed for ranges.The LIBRARY= option specifies the library or catalog (or both) that contains the formats that you are creating. The FMTLIB= option creates a report containing information about your custom formats. There is not a CATALOG= or STORE= option in the PROC FORMAT statement.Copyright © SAS Institute Inc. All rights reserved.797.Which columns are required in an input table to create a format based on numeric ranges?a.FMTNAME, START, and LABELb.FORMAT, START, END, and NAME c.FMTNAME, START, END, and LABEL d.FORMAT, START, LAST, NAME, and TYPECopyright © SAS Institute Inc. All rights reserved.818.Which option in the PROC FORMAT statement specifies a library to store a custom format?a.CATALOG=b.FMTLIB=c.LIBRARY=d.STORE=
Background image
1-64Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.By default, SAS first looks in WORK.FORMATS. If the format is not in that location, SAS looks in LIBRARY.FORMATS.The FMTSEARCH= option must specify search criteria in parentheses. After looking in the default locations, SAS looks in SASHELP.FORMATS and then SASHELP.FMTS.Copyright © SAS Institute Inc. All rights reserved.839.What is the default search order that is used to locate formats?a.LIBRARY.FORMATS WORK.FORMATSb.SASHELP.FORMATS LIBRARY.FORMATSc.SASHELP.FORMATS WORK.FORMATSd.WORK.FORMATS LIBRARY.FORMATSCopyright © SAS Institute Inc. All rights reserved.8510.Which of the following contains valid syntax for the FMTSEARCH= option?a.options fmtsearch=sashelp;b.options fmtsearch=sashelp.formats;c.options fmtsearch=(sashelp sashelp.fmts);d.options fmtsearch=[sashelp.fmts sashelp];
Background image
1.2 Solutions1-65Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 5Tables with different columns can be concatenated, but missing values are generated for columns that exist in one input table and not in another.Parentheses surround all data set options, and another set of parentheses surrounds the columns listed for the RENAME= data set option.Copyright © SAS Institute Inc. All rights reserved.881.Which statement is true concerning concatenating tables?a.All tables must have the same number of columns.b.Columns in all tables must have matching names and lengths.c.Tables must be in the same library.d.Missing values are generated for columns that exist in one input table and not in another.Copyright © SAS Institute Inc. All rights reserved.902.Which statement renames the existing column Location in work.travelas Destination? a.b.c.d.Aset vacations travel(rename=(Location=Destination)); set vacations(rename=(Location=Destination)) travel; set vacations travel(rename=(Destination=Location)); set vacations travel(rename(Destination=Location));
Background image
1-66Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.With match-merging, each input table must first be sorted on the values of the BY columns or have an appropriate index.There will be two rows for Bob and three rows for Sue.Note:There were 2 observations read from the data set WORK.AGETABLE.Note:There were 5 observations read from the data set WORK.FOODTABLE.Copyright © SAS Institute Inc. All rights reserved.923.Which statement is true concerning merging with matching rows?a.The MERGE statement must refer to temporary input tables.b.The columns in the BY statement can be in only one of the tables.c.Only two input tables can be specified in the MERGE statement.d.The input tables must be sorted by the columns in the BY statement.Copyright © SAS Institute Inc. All rights reserved.944.How many rows are in the output table given the following?a.twob.threec.fourd.fivedata both;merge agetable foodtable;by Name;run;work.agetablework.foodtable
Background image
1.2 Solutions1-67Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Note:The data set WORK.BOTH has 5 observations and 3 variables.data agetable; input Name $ Age; datalines; Bob 12 Sue 15 ; run; data foodtable; input Name $ Food $; datalines; Bob Pizza Bob Cupcakes Sue Burgers Sue Grapes Sue Brownies ; data both; merge agetable foodtable; by Name; run;
Background image
1-68Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.There will be a matching row for 121150, a nonmatching row for 121151, a matching row for 121152, and a nonmatching row for 121153.Note:There were 3 observations read from the data set WORK.EMPSAU.Note:There were 3 observations read from the data set WORK.PHONEC.Note:The data set WORK.EMPSAUC has 4 observations and 4 variables.data empsau; input First $ Gender $ EmpID; datalines; Togar M 121150 Kylie F 121151 Birin M 121152 ; data phonec; input EmpID Phone $15.; datalines; 121150 +61(2)5555-1795 121152 +61(2)5555-1667 121153 +61(2)5555-1348 ; data empsauc; merge empsau phonec; by EmpID; run; Copyright © SAS Institute Inc. All rights reserved.965.How many rows are in the output table given the following?a.twob.threec.fourd.fivedata empsauc;merge empsau phonec;by EmpID;run;work.empsauwork.phonec
Background image
1.2 Solutions1-69Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The two tables are not sorted by ID, so the step produces an error.ERROR: BY variables are not properly sorted on data set WORK.DONORS1.data donors1; input ID Type $ Units; datalines; 2304 O 16 1129 A 48 1129 A 50 2486 B 63 ; run; data donors2; input ID Code $ Units; datalines; 1129 63 32 2304 61 45 1387 64 67 ; run; data combine; merge donors1 donors2; by ID; run; Copyright © SAS Institute Inc. All rights reserved.986.What is the result of the following step?a.The table combine is created with four columns and five rows.b.The step fails because the BY column ID is not properly sorted.c.The step fails because Units is in both tables and not the BY column.d.The step fails because of duplicate ID values within the donors1 table.data combine;merge donors1 donors2;by ID;run;work.donors1work.donors2
Background image
1-70Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.S=1 specifies that the stafftable must contribute to the row, and M=0 specifies that the managerstable must not contribute to the row.Copyright © SAS Institute Inc. All rights reserved.1007.Which statement best describes the rows in the output table?a.all the matching rows from both managers and staffb.only the rows from managers that have no match in staffc.only the rows from staff that have no match in managersd.all the matching and nonmatching rows from both managers and staffdata bonuses;merge managers(in=M)staff(in=S);by EmpID;if M=0 and S=1;run;
Background image
1.2 Solutions1-71Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The third iteration is for the nonmatch of Davis. Davisis in the clientstable (C=1) and not the amountstable (A=0).C=1 A=1 Name=Ankerton ID=11123 Amt=92 FIRST.Name=1 LAST.Name=0 _ERROR_=0 _N_=1C=1 A=1 Name=Ankerton ID=11123 Amt=43 FIRST.Name=0 LAST.Name=1 _ERROR_=0 _N_=2C=1 A=0 Name=Davis ID=22298 Amt=. FIRST.Name=1 LAST.Name=1 _ERROR_=0 _N_=3C=1 A=1 Name=Masters ID=33351 Amt=27 FIRST.Name=1 LAST.Name=1 _ERROR_=0 _N_=4data clients; input Name $ ID; datalines; Ankerton 11123 Davis 22298 Masters 33351 ; data amounts; input Name $ Amt; datalines; Ankerton 92 Ankerton 43 Masters 27 ; Copyright © SAS Institute Inc. All rights reserved.1028.What are the values of C and A during the third iteration of the DATA step?a.C=0 and A=0b.C=1 and A=0c.C=0 and A=1d.C=1 and A=1data client_amount;merge clients(in=C) amounts(in=A);by Name;run;work.clientswork.amounts
Background image
1-72Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.data client_amount; merge clients(in=C) amounts(in=A); by Name; putlog _all_; run; The value of Locationis based on the last table read. The loc3 table has a value of Italy for Location.data loc1; input Code $ Location $; datalines; A France ; data loc2; input Code $ Location $; datalines; A Belgium ; data loc3; input Code $ Location $; datalines; A Italy ; Copyright © SAS Institute Inc. All rights reserved.1049.What is the value of Location in the output table?a.Italyb.Francec.Belgiumd.France Belgium Italydata locALL;merge loc1 loc2 loc3;by Code;run;loc1CodeLocationAFranceloc2CodeLocationABelgiumloc3CodeLocationAItaly
Background image
1.2 Solutions1-73Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.data locALL; merge loc1 loc2 loc3; by Code; run; Two DATA steps are needed. In the first DATA step, dataset1and dataset2can be merged by Test.In the second DATA step, dataset3can be merged with the result of the first DATA step by Subject.Copyright © SAS Institute Inc. All rights reserved.10610.A single DATA step can be used to merge the following three tables:a.Trueb.Falsedataset1StudentTestScoredataset2SubjectTestdataset3SubjectAvgScore
Background image
1-74Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 6The implied OUTPUT occurs after the DO loop. The value of QTRis 5, which is one increment beyond the stop value of 4.The index column is incremented at the bottom of each DO loop. The start and stop values must be numeric when used with the keyword TO. The default increment is 1. The index column is in the final table unless specifically dropped.Copyright © SAS Institute Inc. All rights reserved.1091.Which output table is produced from the following step?a.b.c. d.data Earnings(keep=Qtr Earned);Amount=1000; Rate=.075/4;do Qtr=1 to 4;Earned+(Amount+Earned)*Rate;end;run;Copyright © SAS Institute Inc. All rights reserved.1112.Which statement is true regarding the iterative DO loop?a.The start and stop values can be character or numeric values.b.If an increment value is not specified, the default increment is 0.c.The index column is incremented at the bottom of each DO loop. d.The index column is not in the final table unless specifically kept.DOindex-column=startTOstop<BYincrement> ;
Background image
1.2 Solutions1-75Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Four rows are in the output table, one row per each row in the input table. The implied OUTPUT is after the nested DO loops.The final value of Yearis 2020, which is one increment beyond the stop value of 2019.Copyright © SAS Institute Inc. All rights reserved.1133.How many rows are in the output table given the following?a.1b.4c.5d.20data work.savings;set pg2.savings;Savings=0;do Year=1 to 5;do qtr=1 to 4;Savings+Amount;Savings+(Savings*0.02/12);end;end;run;pg2.savingsCopyright © SAS Institute Inc. All rights reserved.1154.What is the final value of Year given the following step?a.. (missing)b.2010c.2019d.2020data invest;do Year=2010 to 2019;Capital+5000;Capital+(Capital*.03);end;run;
Background image
1-76Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.When using WHILE or UNTIL in the DO statement, the expression must be in a set of parentheses. For a, the index column is missing. For c, the parentheses are missing around the expression. For d, the DATE values are character instead of numeric (‘01JAN2019’d).For each row read in, three rows are created (one for each of three months). 2 rows read * 3 months = 6 rows.Copyright © SAS Institute Inc. All rights reserved.1175.Which of the following statements contains valid syntax?a.do 1 to 10 by 2;b.do while (Year>2025);c.do until Earnings<=100000;d.do date='01JAN2019' to '31JAN2019';Copyright © SAS Institute Inc. All rights reserved.1196.How many rows are in the output table given the following?a.2b.3c.6d.12e.24data bikeinfo2;set bikeinfo;do month=1 to 3;do week=1 to 4;bike=bike+2;end;output;end;run;work.bikeinfo
Background image
1.2 Solutions1-77Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.A DO UNTIL is evaluated at the bottom. The initial value of Xis 15. The DO loop occurs one time even though 15 is greater than 12 because the condition is not checked until the bottom of the loop. 15 becomes 16 before the condition is checked.The DO UNTIL loop always executes at least one time because the condition is checked at the bottomof the loop. The DO WHILE loop executes only if the condition is true because the condition is checked at the topof the loop.Copyright © SAS Institute Inc. All rights reserved.1217.What is the value of x at the completion of the DATA step?a.. (missing)b.13c.15d.16data test;x=15;do until(x>12);x+1;end;run;Copyright © SAS Institute Inc. All rights reserved.1238.Which statement is false?a.The DO UNTIL loop executes until a condition is true.b.The DO WHILE loop always executes at least one time.c.The DO WHILE loop checks the condition at the top of the loop.d.The DO UNTIL loop checks the condition at the bottom of the loop.
Background image
1-78Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.When combining an iterative with a conditional, you cannot use extra words such as AND, DO, or OR. The conditional immediately follows the iterative.On the second iteration of the DO loop, DAY=2 and BIKE=14. At the bottom of the loop, DAYbecomes 3. At the top of the loop, the condition is checked. 14 exceeds 13, so the DO loop is over with DAY=3 and BIKE=14.Copyright © SAS Institute Inc. All rights reserved.1259.Which of the following statements contains valid syntax?a.do Age=10 to 14 and while (Weight<150);b.do week=1 to 52 do until (Mileage ge 2750);c.do Increase=5 to 10 while (temperature lt 102);d.do Year=2018 to 2028 or until (Earnings<=100000);Copyright © SAS Institute Inc. All rights reserved.12710.Which output table is produced from the following step?a.b.c. d.data test;bike=10;do day=1 to 7 while (bike lt 13);bike=bike+2;end;run;
Background image
1.2 Solutions1-79Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.Lesson 7The measures (air travel) are spit into multiple columns, which is called a wide table. data new; set sashelp.air; where year(date) between 1956 and 1958 and month(date) between 1 and 6; Year=cats('Yr',year(date)); retain Jan Feb Mar Apr May Jun; if month(date)=1 then Jan=Air; else if month(date)=2 then Feb=Air; else if month(date)=3 then Mar=Air; else if month(date)=4 then Apr=Air; else if month(date)=5 then May=Air; else if month(date)=6 then Jun=Air; if month(date)=6 then output; keep Year Jan Feb Mar Apr May Jun; run; Copyright © SAS Institute Inc. All rights reserved.1301.Which is the better description for the following table?a.wide tableb.narrow table
Background image
1-80Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.When going from a wide table to a narrow table, the OUTPUT statement is needed to create multiple rows from a single row during one iteration of the DATA step.For each row read from the input table work.airwide, three rows are created (one for January data, one for February data, and one for March data). Because there are three rows in the input table, the final table work.airnarrowwill contain 9 rows, (3 input rows * 3 rows created per each iteration).Copyright © SAS Institute Inc. All rights reserved.1322.Which statement is needed for creating multiple rows from a single row when using the DATA step to go from a wide to a narrow table?a.WIDEb.NARROWc.RETAINd.OUTPUTCopyright © SAS Institute Inc. All rights reserved.1343.How many rows will be in the final table if work.airwide contains three rows?a.3b.6c.9d.12data work.airnarrow;set work.airwide;Month='Jan';Air=Jan;output;Month='Feb';Air=Feb;output;Month='Mar';Air=Mar;output;keep Year Month Air;run;
Background image
1.2 Solutions1-81Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.data airwide; set sashelp.air; where year(date) between 1956 and 1958 and month(date) between 1 and 6; Year=cats('Yr',year(date)); retain Jan Feb Mar Apr May Jun; if month(date)=1 then Jan=Air; else if month(date)=2 then Feb=Air; else if month(date)=3 then Mar=Air; else if month(date)=4 then Apr=Air; else if month(date)=5 then May=Air; else if month(date)=6 then Jun=Air; if month(date)=6 then output; keep Year Jan Feb Mar Apr May Jun; run; data work.airnarrow; set work.airwide; Month='Jan’;Air=Jan; output; Month='Feb'; Air=Feb; output; Month='Mar’;Air=Mar; output; keep Year Month Air; run;
Background image
1-82Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The RETAIN statement is needed when using the DATA step to go from a narrow table to a wide table. The RETAIN statement holds values in the PDV across multiple iterations of the DATA step. The KEEP statement controls the columns that makes it to the final table.Due to the BY statement, the PDV contains a column named First.Yearand a column named Last.Year. Last.Yearwill be equal to 1 when the last row of Year is read in from the input table. It is during this iteration that the PDV contents need to be output. Copyright © SAS Institute Inc. All rights reserved.1364.When using the DATA step to go from a narrow table to a wide table, the KEEP statement is needed to hold values in the PDV across multiple iterations of the DATA step. a.Trueb.FalseCopyright © SAS Institute Inc. All rights reserved.1385.Which statement needs to be added to the DATA step to include only the last row per Year in the output table?a.output;b.if Last then output;c.if Last.Year=1 then output;d.if Last.Year=0 then output;data work.airwide2(keep=Year Jan Feb Mar);set work.airnarrow;by Year;retain Jan Feb Mar;if Month='Jan' then Jan=Air;else if Month='Feb' then Feb=Air;else if Month='Mar' then Mar=Air;... insert statement here...run;
Background image
1.2 Solutions1-83Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.data airwide; set sashelp.air; where year(date) between 1956 and 1958 and month(date) between 1 and 6; Year=cats('Yr',year(date)); retain Jan Feb Mar Apr May Jun; if month(date)=1 then Jan=Air; else if month(date)=2 then Feb=Air; else if month(date)=3 then Mar=Air; else if month(date)=4 then Apr=Air; else if month(date)=5 then May=Air; else if month(date)=6 then Jun=Air; if month(date)=6 then output; keep Year Jan Feb Mar Apr May Jun; run; data work.airnarrow; set work.airwide; Month='Jan'; Air=Jan; output; Month='Feb'; Air=Feb; output; Month='Mar'; Air=Mar; output; keep Year Month Air; run; data work.airwide2(keep=Year Jan Feb Mar); set work.airnarrow; by Year; retain Jan Feb Mar; if Month='Jan' then Jan=Air; else if Month='Feb' then Feb=Air; else if Month='Mar' then Mar=Air; if Last.Year=1 then output; run;
Background image
1-84Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.PROC TRANSPOSE cannot sort the data. The data needs to be sorted before the TRANSPOSE statement. The BY statement transposes data within groups.The BY statement transposes the data by the grouping of Day. The ID statement uses the values of Mealas the column headings. The VAR statement transposes the Foodvalues into rows.Copyright © SAS Institute Inc. All rights reserved.1406.Which statement is false concerning the TRANSPOSE procedure? a.Columns are transposed into rows.b.By default, numeric columns are transposed.c.Use a BY statement to sort the data while transposing.d.Use a VAR statement to specifically specify the character and numeric columns to transpose.Copyright © SAS Institute Inc. All rights reserved.1427.Which statements are needed in a PROC TRANSPOSE step for the following example (narrow wide)?a.b.c. d.by Day;id Food;var Meal;by Day;var Meal Food;id Day;var Food Meal;by Day;id Meal;var Food;
Background image
1.2 Solutions1-85Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.data meals; length Day Meal Food $ 10; input Day $ Meal $ Food $; datalines; Saturday Breakfast Yogurt Saturday Lunch Sandwich Saturday Dinner Steak Sunday Breakfast Pancakes Sunday Lunch Salad Sunday Dinner Lasagna ; run; proc transpose data=meals out=meals1(drop=_name_); by Day; id Meal; var Food; run;
Background image
1-86Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The columns of Breakfast,Lunch, and Dinner are transposed into rows. data meals; length Day Meal Food $ 10; input Day $ Meal $ Food $; datalines; Saturday Breakfast Yogurt Saturday Lunch Sandwich Saturday Dinner Steak Sunday Breakfast Pancakes Sunday Lunch Salad Sunday Dinner Lasagna ; run; proc transpose data=meals out=meals1(drop=_name_); by Day; id Meal; var Food; run; proc transpose data=meals1 out=meals2; var Breakfast Lunch Dinner; run; Copyright © SAS Institute Inc. All rights reserved.1448.Which statement or statements are needed in a PROC TRANSPOSE step for the following example (wide narrow)?a.b.c. d.id Day;by Day;var Breakfast Lunch Dinner;id Day;var Breakfast Lunch Dinner;
Background image
1.2 Solutions1-87Copyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The NAME= option specifies the name for the column in the output table that contains the name of the column that is being transposed to create the current row. The default name is _NAME_. data meals; length Day Meal Food $ 10; input Day $ Meal $ Food $; datalines; Saturday Breakfast Yogurt Saturday Lunch Sandwich Saturday Dinner Steak Sunday Breakfast Pancakes Sunday Lunch Salad Sunday Dinner Lasagna ; run; proc transpose data=meals out=meals1(drop=_name_); by Day; id Meal; var Food; run; proc transpose data=meals1 out=meals2 name=Meal; var Breakfast Lunch Dinner; run; Copyright © SAS Institute Inc. All rights reserved.1469.Which option is needed in the PROC TRANSPOSE statement to rename the _NAME_ column?a._name_=Mealb.name=Mealc.prefix=Meald.rename=Meal
Background image
1-88Lesson 1 Lesson QuizzesCopyright © 2022, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED.The RENAME= data set option can be used to change the names of the COL columns.data meals; length Day Meal Food $ 10; input Day $ Meal $ Food $; datalines; Saturday Breakfast Yogurt Saturday Lunch Sandwich Saturday Dinner Steak Sunday Breakfast Pancakes Sunday Lunch Salad Sunday Dinner Lasagna ; run; proc transpose data=meals out=meals1(drop=_name_); by Day; id Meal; var Food; run; proc transpose data=meals1 out=meals2(rename=(COL1=Day_7 COL2=Day_1)) name=Meal; var Breakfast Lunch Dinner; run; Copyright © SAS Institute Inc. All rights reserved.14810.Which option is needed in the PROC TRANSPOSE statement to rename the COL columns?a.out=meals2(COL1=Day_7 COL2=Day_1)b.out=meals2(name=(COL1=Day_7 COL2=Day_1))c.out=meals2(rename=(COL1=Day_7 COL2=Day_1))d.out=meals2(prefix=(COL1=Day_7 COL2=Day_1))
Background image