Question

In: Computer Science

Using the following lines of data, create a temporary SAS data set called ThreeDates. Each line...

  1. Using the following lines of data, create a temporary SAS data set called ThreeDates. Each line of data contains three dates, the first two in the form mm/dd/yyyy descenders and the last in the form ddmmmyyyy. Name the three date variables Date1, Date2, and Date3. Format all three using the MMDDYY10. format. Include in your data set the number of years from Date1 to Date2 (Year12) and the number of years from Date2 to Date3 (Year23). Round these values to the nearest year. Here are the lines of data (note that the columns do not line up):

01/03/1950 01/03/1960 03Jan1970
05/15/2000   05/15/2002   15May2003
10/10/1998 11/12/2000    25Dec2005

Solutions

Expert Solution

The Data Sets are called temporary Data Set if they are used by the SAS program and then discarded after the session is run.

But if it is stored permanently for future use then it is called a permanent Data set. All permanent Data Sets are stored under a specific library.

FUNCTIONS that are we going to use in this as mentioned in 1,2, and 3 points:-

1) Using set function ,we will access the values from the above dataset.

2) Using yrdif function we'll calculate the difference between date1, date2 and date3 variables.

3 Using round command for rounding them(values) along with yrdif function.

NOTE :- Returns the difference in years between two date. YRDIF function has been used to compute ages in this way: age = INT(YRDIF(birth-date, ending-date,'ACTUAL'));

LETS START:- Here I have used seperate data set for loading the values.

data a15009.three;

input @1 Date1 mmddyy10.

@12 Date2 mmddyy10.

@23 Date3 date9. ;

format Date1 Date2 Date3 mmddyy10.;

datalines;

01/03/1950 01/03/1960 03Jan1970 
05/15/2000 05/15/2002 15May2003 
10/10/1998 11/12/2000 25Dec2005 

;

data a15009.threedates;

set a15009..three;

year12 = round(yrdif(Date1,Date2, 'Actual'));

year23 = round(yrdif(Date2,Date3, 'Actual'));

run;

proc print data = threedates;

run;

proc print data = a15009.threedates; run;

Obs Date1 Date2 Date3 year12 year23

1 01/03/1950 01/03/1960 03Jan1970 10   10

2 05/15/2000 05/15/2002 15May2003 2 1

3 10/10/1998 11/12/2000 25Dec2005 2 5 

Related Solutions

(A review on SAS data management) The following is a data set of 12 individuals. And...
(A review on SAS data management) The following is a data set of 12 individuals. And we want to relate the heart rate at rest (Y) to kilograms body weight (X). 90 62 87 41 87 63 73 46 73 53 86 55 100 70 75 47 76 49 87 69 79 41 78 48 Write a program in SAS which read the given data set into SAS library. In your program, create a new data set which is a...
(A review on SAS data management) The following is a data set of 12 individuals. And...
(A review on SAS data management) The following is a data set of 12 individuals. And we want to relate the heart rate at rest (Y) to kilograms body weight (X). X Y 90 62 87 41 87 63 73 46 73 53 86 55 100 70 75 47 76 49 87 69 79 41 78 48 Write a program in SAS which read the given data set into SAS library. In your program, create a new data set which...
From the SAS data set myclass.fueldata, create - a horizontal bar chart showing the average highway MPG for each class;
From the SAS data set myclass.fueldata, create - a horizontal bar chart showing the average highway MPG for each class; - a vertical bar chart showing the average highway MPG for different fuel types; - a histogram showing the distribution of highway MPG for each class; Add a title to each chart and label axes properly. 
Directions: Use SPSS to compute the Regression Line. Problem: Using the following set of data and...
Directions: Use SPSS to compute the Regression Line. Problem: Using the following set of data and Excel, compute the regression line. The data set represents the number of hours of training to predict how severe injuries will be if someone is injured playing football. Briefly summarize your findings. Training Injuries Training Injuries 12 8 11 5 3 7 16 7 22 2 14 8 12 5 15 3 11 4 16 7 31 1 22 3 27 5 24 8...
Each value in the data set is called a ? .    Variables whose values are...
Each value in the data set is called a ? .    Variables whose values are determined by chance are called ? . A Blank 1 consists of all subjects (human or otherwise) that are being studied.    A Blank 1 is a circle that is divided into sections or wedges according to the percentage of frequencies in each category of the distribution.    Tell whether Descriptive or Inferential Statistics has been used. In the upcoming election, it is predicted...
1. Using the Data Set, create and calculate the following in Excel®: Determine the range of...
1. Using the Data Set, create and calculate the following in Excel®: Determine the range of values in which you would expect to find the average weekly sales for the entire sales force in your company 90% of the time, and calculate the following: A. The impact of increasing the confidence level to 95% B. The impact of increasing the sample size to 150, assuming the same mean and standard deviation, but allowing the confidence level to remain at 90%...
Create a program (or set of programs) which accomplish the following for each complex data type...
Create a program (or set of programs) which accomplish the following for each complex data type (list,tuple,set,frozenset, dictionary): create the item with at least 4 elements Append an element Remove an element Insert an element in the middle somewhere Append another array of the same data type Append another array of a different data type (for example, if you have a dictionary, append a set or tuples And do the following: Output the results after each step. Report and explain...
Create a program (or set of programs) which accomplish the following for each complex data type...
Create a program (or set of programs) which accomplish the following for each complex data type (list,tuple,set,frozenset, dictionary): create the item with at least 4 elements Append an element Remove an element Insert an element in the middle somewhere Append another array of the same data type Append another array of a different data type (for example, if you have a dictionary, append a set or tuples And do the following: Output the results after each step. Report and explain...
Write code in SAS to do each of the following I have posted the data below...
Write code in SAS to do each of the following I have posted the data below from a pace delimited data set consisting of 66 randomly selected cars Upload the data set to SAS and store it as a SAS data set called cars. Make sure the full values are stored for all character variables. Create a comparative bar chart (with appropriate title and labels) displaying the brands of each car by fuel type (so that fuel type is on...
From the data set myclass.restaurantratings, create - a scatter digram with a regression line between score and price
From the data set myclass.restaurantratings, create - a scatter digram with a regression line between score and price (use REG statement in PROC SGPLOT) Add a title to the scatter diagram and provide a brief discussion on the relationship between the two variables. 
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT