BookmarkSubscribeRSS Feed
johnhuang12
Calcite | Level 5

Basically I have these two data files which are Inputfile1 and Inputfile2.


To get to the output  we need to match location, country and school code and date. Underneath each date is the amount of students away on the weekend

to match the certaindate variable in inputfile1 with the dates in Inputfile2,  I need to firstly subtract the dates in InputFile2 by 6 and check if Certain date is less then that.

The dates in Inputfile2 are layed out exactly like the way I have put them they dont have a variable assigned to them

Matching the dates

So to match the date we subtract the date in Inputfile2 by 6 and check if CertainDate is less then that, the dates are layed out they don't have any variables assigned to them

Inputfile2

Country Location  SchoolCode

                                                                      26/07/2009     02/08/2009     09/08/2009     16/08/2009     23/08/2009     30/08/2009     06/09/2009     13/09/2009

America  IL       123456                                      24              45

America  GA       456777                                   44              6

America  TXS      456565                                  25              45

Inputfile1

Country     Location       SchoolCode        CertainDate

America         IL               123456       24/07/2009

America        GA              456777       19/07/2009

Output

Country         Location        SchoolCode     DatesAbsent

America                   IL         123456          45

America                  GA        456777         44

Pls Help cheers

1 REPLY 1
ballardw
Super User

I am a bit confused with your statement "The dates in Inputfile2 are layed out exactly like the way I have put them they dont have a variable assigned to them." If there isn't a variable associated then how do they exist in SAS?

You would probably be better off transforming the data from inputfile2 to have variables County, Location, SchoolCode, ComparisonDate (the column headings), and the values in those columns as DatesAbsent. This is likely easy once the date issue is clarified.


sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 355 views
  • 0 likes
  • 2 in conversation