My goal is to update this table called DAGLIGEKORREKTIONER_lib_xlsx: Here i a sample of my data. Don’t mind the cmd prompt it is only to cover sensitive data. I then have a table with a similar structure called DAGLIGEKORREKTIONER: But how do I append the table DAGLIGEKORREKTIONER_lib_xlsx with DAGLIGEKORREKTIONER. And if DAGLIGEKORREKTIONER_lib_xlsx contains rows with the same “approval_text” as DAGLIGEKORREKTIONER
Tag: sas
How to count how many time some value appeard with defined ID in PROC SQL in SAS Enterprise Guide?
I have Table in SAS Enterprise Guide like below: Data type: ID – numeric SERVICE – character ID SERVICE 123 P1 123 P1 123 G 444 AB 56 c2 And I need to know how many time each ID bought each SERVICE, so as a result I need something like below: Because for example ID = 123 bought SERVICE =
How to create flag 0/1 inform whether was changed or not during 4 months between two columns in PROC SQL in SAS Enterprise Guide?
I have table in SAS Enterprise Guide like below: name of table: table123 date typ: ID – numeric DT – numeric VAL1 – string VAL2 – string ID DT VAL1 VAL2 123 20210523 PR P 123 20211222 P P 222 20210502 PR M 222 20210711 M PR 38 20210513 PR PR 991 20211123 M P And I need to create
Group SAS rows based on conditions
I am new to SAS community and need your help for one of my analysis. I have a table like below: ID VAR Group Breach Month 1 A 1 202001 2 A 1 202002 3 A 1 202003 4 A 1 202004 5 A 1 202005 6 A 1 202006 7 A 0 202007 8 A 1 202008 9 A
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
SAS – Group By not working due to case statement in Select
I have an issue where some SAS code using PROC SQL isn’t working as there is a case statement around one of my calculations. The code looks like the below: This code returns duplicated rows for the number of rows in table A. Removing the case statement as below: This just returns the group by using the levels of var1,var2
COUNT to return NULL as 0 in same table in SAS PROC SQL with GROUP BY
I am having a task where I have 1 table. There is a unique ID for transactions, transaction dates, and store names. My task would be to count the number of transactions every store made during March. This, in itself, is simple: This would lead to a table where a store is present only if it had a transaction in
How to generate dynamic table having begin month date and end month date Teradata or SAS SQL
I’d like to generate a dynamic Table with the start date of a month as a column and the end date of the month as another column. Ideally, I’d like to provide two years, f.e. 2016 and 2021. The output I’d like to have when providing these two years is the following: Kindly note that I require the output for
SAS computing multiple new variables from one row
I have a dataset as listed below: and I want to calculate 3 new variables (ERR_CODE, ERR_DETAIL, ERR_ID) according to behavior of certain columns. If V1 is greater than 4 then ERR_CODE = A and ERR_DETAIL = “Out of range” and ERR_ID = [ID]_A If V2 is greater than 4 then ERR_CODE = B and ERR_DETAIL = “Check Log” and