BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Hugo_B
Obsidian | Level 7

The values of those 5 columns/variables are stored in macro variables, and used in the TEMP TABLE and append step.

smijoss1
Quartz | Level 8

I dont think SAS EG is the reason. I use SAS EG on Grid and it works fine for me .. 

I am curious as to why you are processing  1 Row at a time and how many Rows do you have in the table ... 


Depending on your answer i cud tell if it could be written better way.

i do similar macro based fetch when i have to fetch from Oracle, But i always do it in sets of 1000 at a  time 

Astounding
PROC Star

It's curious that you are using 600 steps instead of 2 steps, and then wondering about why the program takes so long.  

 

You only posted the idea of what the program should do, so here's the idea of how to fix it:

 

data subset_a;
   set tablea (obs=200 keep=VarThatINeed);
ordervar = _n_; run; proc sql; create table want as select a.*, b.* from subset_a a, temp b order by ordervar; quit;
ChrisNZ
Tourmaline | Level 20

This whole macro

 

%MACRO MacroProgram;

%let i=1;

data TableWant;Lenght Variable1 $200;run;

%DO %WHILE (&i<150);

data _null_; set TableA; if _N_=&i then call symput('MacroVariable',SomeVariableFromTableA) run; data TEMP; VariableTableTemp=&Macrovariable; run; Proc Append base=TableWant data=TEMP;

 

is identical to this step

data TableWant ; 
  set TableA (obs=150 keep=SomeVariableFromTableA);
  VariableTableTemp=SomeVariableFromTableA;
run;

This does not represent your processing I suppose, but do reduce the number of steps to speed up the process.

 

VDD
Ammonite | Level 13 VDD
Ammonite | Level 13

new user don't really understand KISS.  Keep It Simple Stupid.

 

 

Hugo_B
Obsidian | Level 7

In fact I use information of TABLEA conditionally on some information present in TABLEB.

 

This information from TABLEA is then transformed using TABLEB information a stored in a TEMP Table at each stage of the loop, that is then append to a FINALTABLE.

 

The only way i found to do that is using macrovariables to keep information in memory when going from one table to the other, does this seems correct for you ?

ChrisNZ
Tourmaline | Level 20
I don't know. That's very vague. Maybe formats or a hash table could be used too to retrieve table A information. I don't know your circumstances.
ScottBass
Rhodochrosite | Level 12

@Hugo_B wrote:

In fact I use information of TABLEA conditionally on some information present in TABLEB.

 

This information from TABLEA is then transformed using TABLEB information a stored in a TEMP Table at each stage of the loop, that is then append to a FINALTABLE.


 

You need to tell us EXACTLY what you are trying to do.

 

That description above is way too vague for us to help you.  And we're on the 3rd PAGE of this thread!!!

 

I suspect you don't need macro.  And even if you did, your original approach would be incredibly slow.  Orders of magnitude slower than a data step.

 

The only way i found to do that is using macrovariables to keep information in memory when going from one table to the other, does this seems correct for you ?

 

No it does not.


Please post your question as a self-contained data step in the form of "have" (source) and "want" (desired results).
I won't contribute to your post if I can't cut-and-paste your syntactically correct code into SAS.
smijoss1
Quartz | Level 8

unless you are doing  a PROC HTTP and JSON lib i cant think of scenario where you want to process  1 record at a time in SAS.

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 24 replies
  • 4560 views
  • 2 likes
  • 8 in conversation