Skip to content
Advertisement

Tag: sas

Selecting the maximum date before a certain year

I have a table where I’d like to select only the record with the maximum date: The issue is that I have some IDs in the table where the maximum date is in 2022, so that is what gets selected. How do I select the maximum date for a record that is before 01JAN2022 so that my output look like

counting consecutive months in sas

From the sample data below, I’m trying to count how many consecutive months a member has. In the event if an ID has a gap month in the middle, the output should show the most recent count of consecutive months this member had, see example below. dataset=one ID Month 72 01SEP2020 72 01OCT2020 72 01NOV2020 72 01DEC2020 72 01FEB2021 72

Use a macro in SAS ‘to_date’ conversion

Being forced to pass my code in explicit pass though, the date conversion no longer works. I would like to use the &aaaa macro in the convert function. My code example : I got an error : “The (full) year must be between -4713 and +9999 and be different from 0”. Does anyone have a solution? Answer Macro variables only

How to obtain summary summation when GROUP BY is not working?

I have data with the columns User_id (char) filename (char) filesize (numeric) Every user_id has more than 5 files to it’s name, of different filesize values. Problem statement: I want to have a summary of this table, with columns, User_id, Filesize, where it shows the total size occupied by each user id. It tried Group By user id, in Proc