01-04-2018 11:51 AM
I need to allocate memory (directly in RAM), then write values to it, and then read them. There are a set of SAS functions usually references as APP: ADDR, PEEK, PEEKC, the CALL POKE routine, and their so-called LONG 64-bit counterparts. There are several papers with many examples on how to do so:
but only in the case of using SAS data step. Allocation memory in this case is just declaring a variable (not really a runtime case, but at least something).
data debug; length v $200; pv = addrlong(v); call pokelong('just a value', pv); v2 = peekclong(pv); put 'address: ' pv $hex16.; put 'value: ' v2; run; /* address: 9FFFFFFFEC0A18B0 value: just a value */
01-04-2018 11:57 AM
I don't see how you can. Macro is not and executable language. It is a text find replace system. It is there to simplify the task of writing text, nothing else.
Personally, I would advise that if you having to use these kind of functions in the first place, there is something wrong with the process, and putting it into macro is only going to exacerbate your problems. There are other ways of working with large numbers.
01-04-2018 12:14 PM
01-04-2018 08:40 PM - edited 01-04-2018 08:41 PM
Why? Is this just an experiment or is this for an actual use case? And if it's for an actual use case then can you please explain what you have and what you're actually trying to achieve? Using pokelong() etc. is something rarely done and needed.
@RW9 wrote it already but here again: SAS Macro language is your "automatic typewriter" allowing you to dynamically generate SAS code which then gets executed. Why does this need to be in a macro?
If you just want to write your own function or call routine then may be have a look into Proc FCMP.
01-05-2018 01:10 AM
What do you want to poke into memory?
Are you trying to find a way to take advantage of the newly announce MELTDOWN security bug in INTEL processors?
01-05-2018 05:43 AM - edited 01-05-2018 05:43 AM
I expected this answer but no. And this can be exploited in SAS data step if actually possible to exploit in SAS, no need in pure SAS macro. I was just interested in possibility of memory management using pure SAS macro.