Loading...

Messages

Proposals

Stuck in your homework and missing deadline? Get urgent help in $10/Page with 24 hours deadline

Get Urgent Writing Help In Your Essays, Assignments, Homeworks, Dissertation, Thesis Or Coursework & Achieve A+ Grades.

Privacy Guaranteed - 100% Plagiarism Free Writing - Free Turnitin Report - Professional And Experienced Writers - 24/7 Online Support

If then else sas

07/02/2022 Client: muhammad11 Deadline: 2 Day

Alternatives to SAS® IF-THEN/ELSE Processing Imelda C. Go, Lexington County School District One, Lexington, SCABSTRACT IF-THEN/ELSE statements are simple and easy to use. However, IF-THEN/ELSE statements have their limitations. They are not always easy to read or to make changes to. They may also be less efficient than other methods that are available in SAS. Alternatives discussed include SELECT groups, ARRAY processing, and PROC FORMAT. The discussion includes examples about creating new variables out of existing ones, recoding variable values, validating data, and controlling output appearance. INTRODUCTION IF-THEN/ELSE statements are basic statements for conditional processing. They are simple, easy to learn, and easy to use. However, they may not always provide the easiest solution to programming problems. Fortunately, there are a number of alternatives to IF-THEN/ELSE processing. The paper is in question-and-answer format and will show through contrived examples alternatives to IF-THEN/ELSE processing. The alternatives provided are not necessarily the only or best ways to handle specific programming situations. Do you use IF-THEN/ELSE statements only for conditional processing? The following assigns the teacher and counselor values based on rating. data one; length teacher counselor $30.; input rating $20.; if rating=’Exemplary’ then teacher=’Frodo’; else if rating in (’Poor’, ’Fair’) then do; teacher=’Aragorn’; counselor=’Gandalf’; end; else do; teacher=’unassigned’; counselor=’Legolas’; end; cards; ... ; A SELECT group may be used instead. data one; length teacher counselor $30.; input rating $20.; select (rating); when(’Exemplary’) teacher=’Frodo’; when(’Poor’,’Fair’) do; teacher=’Aragorn’; counselor=’Gandalf’; end; otherwise do; teacher=’unassigned’; counselor=’Legolas’; end; end; cards; ... ; Do you create datasets with subsetting IF-THEN/ELSE statements only to use the resulting data sets as input for exactly the same procedure(s)? The following creates two data sets: one for males and one for females. data males females; input sex $1. grade 2.; if sex=’M’ then output males; elseif sex=’F’ then output females; cards; ... ; proc freq data=males; tables grade; proc freq data=females; tables grade; When the resulting data sets are mutually exclusive subsets of the original data set and they are used with exactly the same procedures, then BY-group processing can be used with procedures that support BY-group processing. In the rewritten code below, the data also has to be sorted according to the variable specified in the BY statement for PROC FREQ. data one; input sex $1. grade 2.; if sex notin (’M’, ’F’) then delete; cards; ... ; proc sort; by sex; proc freq; by sex; tables grade; Do you create datasets with subsetting IF statements in different DATA steps only to use them as input for exactly the same procedure(s)? The following creates two data sets: one for 10th grade males and one for 7th grade females. data one; input sex $1. grade 2.; cards; ... ; data M10; set one; if sex=’M’ and grade=10; proc freq data=M10; tables grade; data F7; set one; if sex=’F’ and grade=7; proc freq data=F7; tables grade;
When exploratory data analysis is performed, the analyst may need to look at several subsets of data to see if anything of interest might appear. Instead of creating a data set for each subset of interest, use the WHERE statement to specify a subset of the data for the procedure. data one; input sex $1. grade 2.; cards; ... ; proc freq; tables grade; where sex=’M’ and grade=10; proc freq; tables grade; where sex=’F’ and grade=7; There is also the WHERE= data set option. data one; input sex $1. grade 2.; cards; ... ; proc freq data=one (where=(sex=’M’ and grade=10)); tables grade; proc freq data=one (where=(sex=’F’ and grade=7)); tables grade; Do you create new variables with conditional statements only to control the appearance of output? In the example below, the gender2 variable is created for the sole purpose of printing more user-friendly values of M and F (instead of 1 and 2) in PROC FREQ output. data one; input gender; if gender=1 then gender2=’F’; else if gender=2 then gender2=’M’; cards; ... ; proc freq; tables gender2; Instead of creating a new variable, create a user-defined format to control the appearance of output. PROC FREQ will print the values of the gender variable as F and M instead of 1and 2. data one; input gender; cards; ... ; proc format; value gender 1=’F’ 2=’M’; proc freq; format gender gender.; The gender. format may be applied by using the FORMAT statement with a procedure, or it may be applied in the DATA step as shown below. If the format is applied in the DATA step, then the same format will apply to the variable in procedures where the variable is used. proc format; value gender 1=’F’ 2=’M’; data one; input gender; format gender gender.; cards; ... ; proc freq;Do you validate data using conditional statements? Suppose that the valid values for a gender variable are 1 and 2 and that other values are invalid. data one; input gender; if gender notin (1,2) then gender=.; cards; ... ; An informat can be used to perform simple data validation. If all the valid values for a variable are specified, all othervalues can be considered invalid. The keyword OTHER is used to indicate range values that are not included in all the other ranges for an informat. When _ERROR_ is specified as an informatted value, all values in the corresponding informat range are not valid and a missing value will be assigned to the variable. When _SAME_ is specified as an informatted value, a value in the corresponding informat range stays the same. Suppose that values from a variable with integer and non-integer values need to be validated and the only valid values are 1 and 2. The following INVALUE statement uses _SAME_, _ERROR_ , and OTHER for this task: proc format; invalue check 1=_same_ 2=_same_ other=_error_; An informat’s range can be specified as a list of values separated by commas. The following statement is functionally equivalent to the previous one: proc format; invalue check 1,2=_same_ other=_error_; The informat is used in the input statement. SAS will assign a missing value to gender if a value other than 1 or 2 is encountered. data one; input gender check.; cards; ... ;

Homework is Completed By:

Writer Writer Name Amount Client Comments & Rating
Instant Homework Helper

ONLINE

Instant Homework Helper

$36

She helped me in last minute in a very reasonable price. She is a lifesaver, I got A+ grade in my homework, I will surely hire her again for my next assignments, Thumbs Up!

Order & Get This Solution Within 3 Hours in $25/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 3 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 6 Hours in $20/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 6 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

Order & Get This Solution Within 12 Hours in $15/Page

Custom Original Solution And Get A+ Grades

  • 100% Plagiarism Free
  • Proper APA/MLA/Harvard Referencing
  • Delivery in 12 Hours After Placing Order
  • Free Turnitin Report
  • Unlimited Revisions
  • Privacy Guaranteed

6 writers have sent their proposals to do this homework:

Assignment Hub
Top Grade Essay
Financial Hub
Assignment Guru
Best Coursework Help
Engineering Help
Writer Writer Name Offer Chat
Assignment Hub

ONLINE

Assignment Hub

I have worked on wide variety of research papers including; Analytical research paper, Argumentative research paper, Interpretative research, experimental research etc.

$52 Chat With Writer
Top Grade Essay

ONLINE

Top Grade Essay

I can assist you in plagiarism free writing as I have already done several related projects of writing. I have a master qualification with 5 years’ experience in; Essay Writing, Case Study Writing, Report Writing.

$62 Chat With Writer
Financial Hub

ONLINE

Financial Hub

This project is my strength and I can fulfill your requirements properly within your given deadline. I always give plagiarism-free work to my clients at very competitive prices.

$67 Chat With Writer
Assignment Guru

ONLINE

Assignment Guru

I will provide you with the well organized and well research papers from different primary and secondary sources will write the content that will support your points.

$52 Chat With Writer
Best Coursework Help

ONLINE

Best Coursework Help

I have written research reports, assignments, thesis, research proposals, and dissertations for different level students and on different subjects.

$72 Chat With Writer
Engineering Help

ONLINE

Engineering Help

I am a professional and experienced writer and I have written research reports, proposals, essays, thesis and dissertations on a variety of topics.

$80 Chat With Writer

Let our expert academic writers to help you in achieving a+ grades in your homework, assignment, quiz or exam.

Similar Homework Questions

Wolfpack construction has the following account balances at the end of the year. - Marketing Strategies New England College - Shuspace shu ac uk - Current issues and enduring questions 8th edition pdf - Test the theory to determine cause - Chapter 1 activity basic concepts street law answers - Http www apa org pubs databases psycinfo index aspx - Dikw examples in nursing - Acap master of social work qualifying - Political Science Organizational Assessment Power point Briefing - Th to f phonological process - Sapling homework answers organic chemistry - Rape culture infographic - Separation of mixtures experiment - Reflection paper - Long term capital management case study - Tax research - Wk 6 forum 2 Jearld - How to calibrate a thermometer boiling point method - Consider how to define net exports and net capital outflow - 65 in roman numerals - Duscssion Question - PEER REVIEW ESSAY ( SUMMARY PARAGRAPH AND RESPONSE PARAGRAPH - Uci summer session enrollment - Urgent - 70 768 dumps pdf - Accounting comprehensive problem answers - Sample brd document for mobile app - 4-5 slides - Theories of punishment - Wk 1, IOP 490: Workplace Assessment – The Whole System - Cos nx sin mx - Arguments against mobile phones in school - Macrobertson international croquet shield - Conflict Resolution through Emotional Competence - Keep under god in the pledge of allegiance - Teach in past tense - Jamie eason live fit meal plan phase 1 - His 100 project 3: multimedia presentation - Master of economics uq - Ashby castle tennis club - Pratt & whitney f119 cost - Air france aog desk - Module 1 Lab 3: Quantum Mechanics and Rutherford Scattering - Arousal cycle challenging behaviour - Sewa approved vendor list - Heatmiser rf switch manual - Us liner cranberry pa - Microeconomics - Nursing - Does a stock split increase par value - Essay on use of mobile phones by students - Material selection process and methods - Air cargo tracking system ppt - 3kg in pounds and ounces - Wheatley international income statement - Quicksilver cruises port douglas qld - Comp xm board query answers round 1 - Health Information Management System Week 4 Project - Barium hydroxide and nitric acid - Audi q5 2021 brochure - Uses of histogram in daily life - Chemistry lab report - Holy child school killiney - Pros and cons of dsm - How to delete textbook solutions on chegg - Big brother portugal tvi - The jetset diaries ethereal whispers maxi dress - Balance sheet ratio analysis worksheet - Series and parallel circuits interactive activities - Health policy journal 2 - Persuasive speech on the importance of eating breakfast - Fe3+ scn fescn2+ equilibrium constant - Lab 3 diffusion and osmosis answers - Volvo antenna ring symptoms - How to make a grade calculator in python - How many units in 3 ml - In regression analysis the residuals represent the - Ends ways and means model - Tri star, inc., has the following mutually exclusive projects: - Strategies for Academic Sucess - Structure of a leaf and its functions - Greatest discoveries with bill nye genetics - Breaksafe 6000 wiring diagram - Veritas gmat test series - Paper typed - Samford valley community noticeboard - Communication and human behavior 6th edition pdf - What are the sources for church teaching on moral issues - Two fold serial dilution - Essay 1 page - Character Evolution Thesis statement - Banrock station crimson cabernet review - Wanderer poly icebox 25l - Hugh stewart hall rooms - Calculate volume of a box in litres - Module 5 Homework - The great gatsby chapter 3 quiz doc - Metal activity and reactivity oxidation and reduction reactions lab answers - What is handshaking in microprocessor