07-30-2020
paulrockliffe
Obsidian | Level 7
Member since
10-18-2016
- 100 Posts
- 5 Likes Given
- 0 Solutions
- 2 Likes Received
-
Latest posts by paulrockliffe
Subject Views Posted 1465 05-21-2020 02:11 PM 1502 05-21-2020 12:58 PM 1523 05-21-2020 12:16 PM 1555 05-18-2020 02:40 PM 1567 05-18-2020 02:13 PM 1582 05-18-2020 11:57 AM 1616 05-18-2020 08:26 AM 1626 05-18-2020 06:45 AM 4832 05-02-2020 05:47 AM 4826 05-02-2020 05:28 AM -
Activity Feed for paulrockliffe
- Got a Like for SQL to Filter with an existing table. 07-23-2021 01:30 PM
- Posted Re: Adding a Calculated Field When Joining Two Tables via a Hash Table on SAS Enterprise Guide. 05-21-2020 02:11 PM
- Posted Re: Adding a Calculated Field When Joining Two Tables via a Hash Table on SAS Enterprise Guide. 05-21-2020 12:58 PM
- Posted Adding a Calculated Field When Joining Two Tables via a Hash Table on SAS Enterprise Guide. 05-21-2020 12:16 PM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-18-2020 02:40 PM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-18-2020 02:13 PM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-18-2020 11:57 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-18-2020 08:26 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-18-2020 06:45 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-02-2020 05:47 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-02-2020 05:28 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-02-2020 04:14 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-02-2020 04:13 AM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-01-2020 03:35 PM
- Posted Re: Appending Tables With Dates in the Table Names on SAS Programming. 05-01-2020 02:28 PM
- Posted Appending Tables With Dates in the Table Names on SAS Programming. 05-01-2020 09:39 AM
- Posted Re: Looping a Parameter in a Program in EG on SAS Enterprise Guide. 03-12-2020 12:56 PM
- Posted Re: Looping a Parameter in a Program in EG on SAS Enterprise Guide. 03-12-2020 12:41 PM
- Posted Re: Looping a Parameter in a Program in EG on SAS Enterprise Guide. 03-12-2020 06:19 AM
- Posted Re: Looping a Parameter in a Program in EG on SAS Enterprise Guide. 03-11-2020 12:24 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 1 1 -
My Liked Posts
Subject Likes Posted 1 04-17-2019 10:10 AM 1 02-20-2018 06:57 AM
05-21-2020
02:11 PM
Thanks, I'm creating a key by concatenating two of my variables and a flag that is 1 if one of the variables is over 100. I want to add those as new variables rather than subsetting directly as I'm running a few different operations from the resulting dataset.
... View more
05-21-2020
12:58 PM
Thanks, you couldn't just add a quick example for me, I'm not sure I really have the syntax for this straight in my head! Cheers
... View more
05-21-2020
12:16 PM
I have the programme below that I use in Enterprise Guide to subset a massive table. I want to add some calculated fields at the same time, to allow me to subset the table further for various conditions. How do I do that? data WORK.EXAMPLE (keep = Var1 Var2 Var3 Var4 Var5) ; if 0 then set WORK.HASH WORK.SOURCE; if _n_ = 1 then do; declare hash l (dataset:"WORK.HASH"); l.definekey("Var2"); l.definedata("Var2r", "Var1", "Var3"); l.definedone(); end; set WORK.SOURCE ; if l.find() = 0 Output; Run; I can do it quite easily with Query Builder, but I'm trying to avoid creating a second copy of the data on my server - The initial subset creates a 14Gb file, so it's not one to duplicate! Thanks.
... View more
05-18-2020
02:40 PM
Thanks, the only value common to each table and with the same name is the one I'm using as the key. If I only want to take that value from either table, not both, then does it still need to be renamed? Can I not just not include the key when I use definedata?
... View more
05-18-2020
02:13 PM
Thanks, I managed to get that far, the bit I can't work out is how I output both variables from the hash table and variables from the table I'm using the hash table to subset, all in a single table. I'm essentially trying to do an inner join between the two tables and select columns from both. I'm only able to get data from one table or the other.
... View more
05-18-2020
11:57 AM
Thanks, I think I can work that out. I've spent all afternoon reading about hash tables and I'm struggling with getting the output table to include variables from both the has table and the table I'm filtering. Some pointers for that would be really helpful. Cheers
... View more
05-18-2020
08:26 AM
I should add I modified the code to simply import from a particular table rather than stitch tables together as well. I want to be able to add conditions to this import. New code is: data Want; if _n_ = 1 then do; declare hash l (dataset:"Server.Lookup"); l.definekey("Ref"); l.definedone(); end; set Server.Data; if l.check() = 0; run; I'd also like to be able to limit the data coming in by adding where clauses to the above eg, where Date_Column > &Date then yes, otherwise no. Thanks!
... View more
05-18-2020
06:45 AM
Thanks for all the help, I've got this all up and running now and it works really well! I'm using the same approach for something else and wondered if it was simple to add a couple of extra features: How do I modify the code so that the lookup table is joined on a key that has a different name in each table? How do I modify it so that rather than bringing every field from one table into the resulting table it brings only columns (from both tables) that are explicitly defined? I'm modifying another process to use the same approach, that was done in Query Builder where the Join was defined and columns chosen, so I want to mimic that rather than get the right output in a second step. Thanks again!
... View more
05-02-2020
05:47 AM
Yeah, this table would have been setup decades ago, I suspect it's like this because something was simpler to integrate with another system like this. It goes back to a time when very little consideration was given to people actually wanting to access the data. Not something I have any control over and it's a legacy system, so it's not going to get changed to help me! I've started integrating the new system's data with this and it's at least been done properly!
... View more
05-02-2020
05:28 AM
Thanks, there's 17,000 values in my 'small' table and millions in the big table, so I think the hash table approach is the one.
... View more
05-02-2020
04:14 AM
Thanks, I'll have a look and see how it goes.....
... View more
05-02-2020
04:13 AM
I did put it in the first post. In the UK the Tax year is a fairly common concept, with month one being April and month 12 being March, though this data should have been set up using Calendar months as it's a total pain to work with, for no benefit at all.
... View more
05-01-2020
03:35 PM
I changed &start_date. to "&start_date"d and the same for &end_date and that seems to have worked. However it looks like the date offset I described isn't being covered - 202001 is April, 202002 is May etc: I have tables up to April 2020, which is 202001, but if I put the end date as 01 April 2020, I get errors: name_20202 does not exist, name_202003 does not exist. From the April 2020 date, nothing past 202001 should be requested. I've offset my dates by a couple of months to get the right period while that problem gets sorted and it looks like I'm getting the right data, certainly the volume looks correct anyway. So thanks so much for getting me this far, it's a huge help as I was using a legacy system to run some old SQL to create a .csv file and then importing it into SAS, this will let me automate the process and strip a load of time out.
... View more
05-01-2020
02:28 PM
Thanks Kurt, I'm just trying to get your solution to work. I've not used date prompts in a while, it's throwing an error because when I set the Prompt up as a Day, it passes the value "31Jan2015" to the code. I'm presuming that's not in the right format though. How does that date need to be setup?
... View more
05-01-2020
09:39 AM
I have a background system that is serving up monthly table to our analytics function. Each table is named "name_202001", "name_202002" etc. Where 2020 is the Year and 01 is the end date of the month number of the tax year. So 01 is 30th of April, 02 31st of June etc. I am using Enterprise Guide and would like a program that appends these tables based on a start and end date Parameter. There's a kicker, there always is. These tables contain a huge huge number of references, and I'm aiming to be able to combine around 60 tables into one. I have another table that contains a small list of references that is just the subset that I want So I need the program to filter as it goes, rather than combining all 60 tables and then filtering them afterwards. Does that make sense? Anyone know how it's done? Thanks!
... View more