SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Lida
Obsidian | Level 7

Hi Astounding,

Thank you for great suggestions. I will follow your advice. It should work.

Thank you ALL for the input and have a great day. I will mark this question answered.

Lida

art297
Opal | Level 21

Without being familiar with the input data, and not knowing what your included code is doing, one can only guess.

However, if all you need to do is calculate the individual variances, as well as the overall variance, why not just use proc summary?

e.g., it works quite quickly for a small file with 250,000 levels of the class variable:

data test;

  do bstr=1 to 250000;

    x=4;

    output;

    x=6;

    output;

    if bstr lt 15000 then do;

      x=8;

      output;

    end;

  end;

run;

proc summary data=test;

  class bstr;

  var x;

  output out=variance var=variance_x;

run;

Reeza
Super User

I think proc summary would only simplify the last portion of the code the OP wanted as the the variance required is the variance of the life expectancy estimates produced by the macro.

Tom
Super User Tom
Super User

Not really any less efficient if you make the index first.

You will really only be reading the large file twice.

1) Creatinge the index on BSTR.

2) Creating the individual files will use the index so each disk block of the 1.5 gig file will be read only once or twice.

Lida
Obsidian | Level 7

I thought about using an INDEX too. Will try. Thank you Tom for the advice!

Haikuo
Onyx | Level 15

I don't know the up limit of how many tables you can generate on one pass. But I concur with Tom. You should be able to solve your problem by using his suggestion. Of course, it may not as efficient as your original plot though.

just my 2 cents,

Haikuo

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

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
  • 20 replies
  • 2604 views
  • 6 likes
  • 6 in conversation