A MEMSIZE of 2GB is a bit low these days. To give you some idea our current SAS server MEMSIZE setting is 6GB. Talk to your SAS administrator about an increased limit. At the end of the day hashes are loaded into memory so there is a limit to their size so they are no suited to very large data volumes.
If you are using 32 bit SAS, then 2 GB is the maximum you can use. But your sas admin should must know this.
There are ways to run programs with limited resources. Consult Paul Dorfman's papers. If you explain your issue with a constructed SAS dataset and your requirements, someone can come out with an efficient way to tackle memory issues.
Just want to second the suggestion for reviewing Paul Dorfman's papers (and book) on hashing.
Think about limiting the variables in the hash table (do you need them all?). As a sanity check, if you load only the keys, will they fit in memory?
Sometimes you can hash in chunks (so when processing a dataset, load a hash table with data from a subset of rows, use the hash table, and then empty the hash table before loading it with data from the next chunk).
If you can't do what you want with hash tables, there are of course other approaches for lookups that are less memory intensive but may be slower / more disk IO.
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.
Ready to level-up your skills? Choose your own adventure.