Recently in the SAS Community Library: SAS' @AndyRavenna publishes the second of two posts that uses statistics and machine-learning objects in SAS Visual Analytics to address real-world business problems.
Hi all, I have a test data with missing values and I want to fill the table by taking previous month's value. Test data ID response date 1 CR 02Jan2020 2 PR . 3 NE 04Jan2020 4 SD . 5 PR 05Jan2020 6 CR . data I want to have ID response date 1 CR 02Jan2020 2 PR 02Jan2020 3 NE 04Jan2020 4 SD 02Jan2020 5 PR 05Jan2020 6 CR 05Jan2020 So, if the response NE, then I don't want to retain the NE date but the date before NE. But if the response is not NE, then I wanna retain the previous date. I tried multiple ways, but couldn't figure it out. Please help.
... View more
Hi all, SAS amateur here! I am trying to figure out how to create 2 new variables and assign values to each observation based on the data contained in a reference file. I have created a mock example below. The first dataset is the main one I need to keep. It contains data on individual stores and several stores will have the same corporate ID. The second dataset is a reference that contains approximately 500 Corporate IDs and addresses, including the State and City. I would like to create 2 new variables for CorpState and CorpCity in Dataset 1 based on the CorpID contained in both files. Is this even possible to do and where do I start? Any help would be greatly appreciated. Dataset 1 (Have): Main dataset with individual store information Obs# CorpID StoreID StoreState 1 4002 40021234 AL 2 4002 40021237 MS 3 4003 40035678 TN 4 4100 41007890 WV 5 4110 41103456 NC 6 4110 41103478 NC 7 4597 45972345 WA 8 4975 49750023 WY Dataset 2 (Have): Reference dataset with corporate information Obs# CorpID CorpState CorpCity 1 4002 AL Birmingham 2 4003 GA Atlanta 3 4004 TN Nashville 4 4100 SC Charleston 5 4110 NC Charlotte 6 4111 FL Tampa 7 4597 CA San Francisco 8 4975 WY Jackson Want: Dataset 1 file containing store and corporate information Obs# CorpID CorpState CorpCity StoreID StoreState 1 4002 AL Birmingham 40021234 AL 2 4002 AL Birmingham 40021237 MS 3 4003 GA Atlanta 40035678 TN 4 4100 SC Charleston 41007890 WV 5 4110 NC Charlotte 41103456 NC 6 4110 NC Charlotte 41103478 NC 7 4597 CA San Francisco 45972345 WA 8 4975 WY Jackson 49750023 WY
... View more
data test; input id fname $4. lname $5. age; cards; 123 abc1 def1 24 124 abc2 def2 25 125 abc3 def3 26 ; run;
data test2; input id state $7. county $9. ; cards; 123 state1 county1 124 state2 county2 125 state3 county3 ; run;
options orientation=landscape; ods pdf file="location\name.pdf"; Title1 "Test"; ods proclabel='';
proc report data=test contents='' headline nowindows ;by id ; columns id fname lname age; run;
proc report data=test2 contents='' headline nowindows ;by id ; columns id state county; run;
ods pdf close;
Iam looking only one table of contnets for both tables on left side ? is there any i can do and get the ouput ?
... View more
https://communities.sas.com/t5/SAS-Programming/Overlapping-drugs/m-p/930264#M365992
My query is in continuation of the above question which I posted few weeks back, I was unable to continue the same topic as it was closed. How can I know the difference between 'SGA_START' and 'start'? I am trying to merge the dataset 'want' with 'SGA2', how ever I cannot identifying the difference/no. of days between SGA_START and start dates. Can someone please help me with the code.
Thank you
... View more
Hello, I am analyzing data for a project. Unfortunately, the data was provided in tables in PDF documents. We imported the PDF tables into Excel and some of the data split into multiple rows. We then read the data into SAS for analysis. Is there a way in SAS to combine data in different rows without a linking ID (the linking ID itself is split). I've attached a sample of fake data below that has the same structural issues I am looking to resolve. Each row should start with "Initiating Action:" - any data in a row that does not have this needs to be combined with the row above it. Any recommendations for how I should proceed with cleaning this are much appreciated.
What I have:
Event Type
ID
Case Type
Initiating Action: Pet
X-000-CV-2024-
Admin
0123
Initiating Action:
X-000-CV-2024-
Contract &
Complaint
4432
Debts
Initiating Action: Pet
X-000-CV-2022-
Admin
0681
Initiating Action:
X-000-CV-2023
Miscellaneous
Complaint
0873
Issue
What it needs to look like:
Event Type
ID
Case Type
Initiating Action: Pet
X-000-CV-2024-0123
Admin
Initiating Action: Complaint
X-000-CV-2024-4432
Contract & Debts
Initiating Action: Pet
X-000-CV-2022-0681
Admin
Initiating Action: Complaint
X-000-CV-2023-0873
Miscellaneous issue
... View more