Help using Base SAS procedures

anything wrong with the macro

Accepted Solution Solved
Reply
Contributor
Posts: 74
Accepted Solution

anything wrong with the macro

Hello,

 

Why there is nothing for table stack_monthly? Anything wrong with the macro? I attached part of the data for chargedisb. Please help, thanks!

 

%macro pull(stack, where);
PROC SQL;
CREATE TABLE &stack. AS
SELECT
*
FROM
chargedisb
&WHERE.

%mend;


%pull(stack_monthly, where month3 ='January' );
%pull(stack_ytd, where month3 is not null );


Accepted Solutions
Solution
‎10-05-2016 01:45 PM
Super User
Posts: 10,487

Re: anything wrong with the macro

[ Edited ]

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

 

The instructions here will allow you to create data step code that you can paste to the forume or attach as a TEXT file to create a data set we can test code against: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

A very likely cause is that you are missing a ; to end the create table statement and  missing quit; to end the Proc Sql

View solution in original post


All Replies
Solution
‎10-05-2016 01:45 PM
Super User
Posts: 10,487

Re: anything wrong with the macro

[ Edited ]

Many users here don't want to download Excel files because of virus potential, others have such things blocked by security software. Also if you give us Excel we have to create a SAS data set and due to the non-existent constraints on Excel data cells the result we end up with may not have variables of the same type (numeric or character) and even values.

 

The instructions here will allow you to create data step code that you can paste to the forume or attach as a TEXT file to create a data set we can test code against: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

 

A very likely cause is that you are missing a ; to end the create table statement and  missing quit; to end the Proc Sql

Super User
Posts: 5,081

Re: anything wrong with the macro

Assuming you fix the errors already pointed out ...

 

It looks like your month values are centered.  The actual value would never be "January" because there would be leading blanks.  In SAS, "January" and "   January" are different.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 275 views
  • 0 likes
  • 3 in conversation