BookmarkSubscribeRSS Feed
nhev
Fluorite | Level 6
Hello everyone,
I was blé to get the frequency on 2 variables age and score and plot an histograms for both using the following formulas
Proc freq
Data=Risk3;
Tables age;
Where status=‘full time’
Run;

Proc sgplot data= Risk3;
Histogram age/ scale=count;
Where status =‘full time’ and decision in ( pass, overide, overiden);

Run;

I wrote the same steps and formula with score ( by replacing age by score).

Now I am looking to create a macro using the same formulas as a base to plot the frequencies and SAS charts but on 3 others more variables time, arrears and income. Anyone knows how to proceed?

Thank you indeed
14 REPLIES 14
andreas_lds
Jade | Level 19

The where-statement in proc sgplot seems to create errors, due to missing quotes.

 

Step 1: Wrap the code in %macro and %mend, spend some time on choosing a proper name for the macro. Execute it. If the result is still what it was before, go ahead to Step 2.

 

Step 2: Identify the things that need to be replaced, add parameters for them and use &your_param. in the appropriate places. Re-run the macro, providing the original value, check the log.

nhev
Fluorite | Level 6
Hello everyone,
I was blé to get the frequency on 2 variables age and score and plot an histograms for both using the following formulas
Proc freq
Data=Risk3;
Tables age;
Where status=‘full time’
Run;

Proc sgplot data= Risk3;
Histogram age/ scale=count;
Where status =‘full time’ and decision in ( pass, overide, overiden);

Run;

I wrote the same steps and formula with score ( by replacing age by score).

Now I am looking to create a macro using the same formulas as a base to plot the frequencies and SAS charts but on 3 others more variables time, arrears and income. Anyone knows how to proceed?

Thank you indeed
nhev
Fluorite | Level 6
Hello everyone,
I was blé to get the frequency on 2 variables age and score and plot an histograms for both using the following formulas
Proc freq
Data=Risk3;
Tables age;
Where status=‘full time’
Run;

Proc sgplot data= Risk3;
Histogram age/ scale=count;
Where status =‘full time’ and decision in ( pass, overide, overiden);

Run;

I wrote the same steps and formula with score ( by replacing age by score).

Now I am looking to create a macro using the same formulas as a base to plot the frequencies and SAS charts but on 3 others more variables time, arrears and income. Anyone knows how to proceed?

Thank you indeed

nhev
Fluorite | Level 6
Hello everyone,
I was blé to get the frequency on 2 variables age and score and plot an histograms for both using the following formulas
Proc freq
Data=Risk3;
Tables age;
Where status=‘full time’
Run;

Proc sgplot data= Risk3;
Histogram age/ scale=count;
Where status =‘full time’ and decision in ( pass, overide, overiden);

Run;

I wrote the same steps and formula with score ( by replacing age by score).

Now I am looking to create a macro using the same formulas as a base to plot the frequencies and SAS charts but on 3 others more variables time, arrears and income. Anyone knows how to proceed?

Thank you indeed
andreas_lds
Jade | Level 19

 

Please stop re-posting the same question over and over again!

nhev
Fluorite | Level 6
You don’t have to tell me what to do.
I couldn’t have a response to my question so I simply repost it. I don’t see where is the issue
andreas_lds
Jade | Level 19

@nhev wrote:
You don’t have to tell me what to do.
I couldn’t have a response to my question so I simply repost it. I don’t see where is the issue

I gave you an answer, if you don't understand it, ask. Also note, that re-posting the same question is just annoying and will hardly help getting a full solution to your problem.

nhev
Fluorite | Level 6
That’s correct I didn’t understand it so I simply repost. Someone else could help me to see things in a different view so for me I still haven’t got a reply
Kurt_Bremser
Super User

You got an answer to a question; the reason that the answer is not understandable for you might be how you initially stated your question, so re-posting the identical question won't help.

Instead please reply to the answer and say what in particular you do not understand, so we can elaborate.

Mind that we have no clue about your current expertise, so an answer might assume a level of SAS knowledge that you do not yet have.

Kurt_Bremser
Super User

@nhev wrote:
You don’t have to tell me what to do.

(Super-User speaking) Oh yes, we have, if you don't behave responsibly.

 


@nhev wrote:
I couldn’t have a response to my question so I simply repost it. I don’t see where is the issue

Lie. You got an answer; instead of replying to it, you reposted the identical question again and again, forcing us to merge it back into the original thread.

nhev
Fluorite | Level 6
UNBELIEVABLE. You think you have the right to call me a liar because I asked a question? Do you think you own the chat?
Kurt_Bremser
Super User

@nhev wrote:
UNBELIEVABLE. You think you have the right to call me a liar because I asked a question? Do you think you own the chat?

I concede that you might simply have overlooked the answer that was already given. But still your statement that you did not get an answer was not what people usually call "the truth".

 

Let's end this and get back to the issue at hand: how do we need to elaborate on the answer already given to get closer to solving your issue?

 

 

Astounding
PROC Star

Your original post started out as a lie:

 

I was able to get the frequency on 2 variables age and score and plot an histograms for both using the following formulas.

 

Both of the steps you posted contain an error.  Neither will work.  Maybe you got something to work, but it's not the code that you posted.

 

What does this say about you?  I don't know.  But I know it plays a role in why you got very little response to your question.  For a macro to work, the code within it has to work.  Once you wrap the code inside a macro, it becomes much more difficult to debug.  So I wouldn't waste my time putting a macro around it when I know the macro has to fail.  Rightly or wrongly, I am imagining that I would have to solve 3 or 4 questions instead of 1 ... how to write a macro, how to correct errors that result, and likely how to add functionality that is not included in your simplified program. 

 

If you get your part right, there are dozens of posters who could easily answer your question.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 14 replies
  • 1203 views
  • 3 likes
  • 4 in conversation