Help using Base SAS procedures

Having count

Reply
Frequent Contributor
Posts: 118

Having count

I want to eliminate the variable having less than 36 observations This is my program but it does not work

proc sql;
create table fundno_limit as
select *
from joint_data
where mret is not null
group by rank_no
Having count(mret)>=36
order by rankdate and rank_no;
quit;

Super User
Posts: 5,096

Re: Having count

There may be more changes needed, but you could start with:

 

order by rankdate, rank_no;

Super User
Posts: 10,538

Re: Having count

Doesn't work is awful vague.

Are there errors in the log: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.

No output? Post any log in a code box.

 

Unexpected output? Provide input data in the form of a dataset, the actual results and the expected results. Data should be in the form of a data step. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

 

Frequent Contributor
Posts: 118

Re: Having count

no there is not an error in the log.

However I did not succed to join database I can not find  myfolders folder and Edit the AutoExec file to add the program to your autoexec

it is really a trouble for me 

. can explain for me haw to add data to this forum................

Super User
Posts: 17,912

Re: Having count

@sasphd I'll be happy to walk you through the instructions. They're currently numbered steps, which step are you having issue with?

Frequent Contributor
Posts: 118

Re: Having count

 

Step 2 I can not find myfolders folders to place the file

 

1. Download the zip file from Mark's blog: http://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/

2. Extract the zip file and place the data2datastep.sas program into your myfolders folder set up.

Screen Shot 2016-03-23 at 8.03.29 PM.png

3. In SAS University Edition, go to the Edit the AutoExec file to add the program to your autoexec

Screen Shot 2016-03-23 at 8.04.29 PM.png

 

4. In the Autoexec, add the reference to the program, and RUN, then SAVE.

 

%include '/folders/myfolders/data2datastep.sas' /lrecl=1000;

Screen Shot 2016-03-23 at 8.04.44 PM.png

 

 

5. Test the code in SAS UE

 

%data2datastep(cars,sashelp,,5)

6. A file is generated called create_sashelp_CARS_data.sas

Super User
Posts: 17,912

Re: Having count

When you set up SAS UE you set up a folder called myfolders? This assumes you're using SAS UE, if not these instructions don't apply.

 

If you don't remember where you set up myfolders, open VirtualBox, go to the shared folders setting and find the path.  That's where you can place the file.  

 

AS A LAST RESORT

If you absolutely cannot figure out the location, paste the full macro code into your autoexec program itself and DON'T include the %INCLUDE statement. 

OR paste the macro program into a SAS UE window, run the code and then skip to step 5. 

 

Actually you'll still need to find where myfolders is set up so that you find the file with the data step code. 

 

Frequent Contributor
Posts: 118

Re: Having count

 

What do you mean by paste the full macro code into your autoexec program itself and DON'T include the %INCLUDE statement. 

is this the macro

%include'/folders/myfolders/data2datastep.sas' /lrecl=1000;

 My problem is that I have SAS 9.4 from my university so I did not succedd to find all folders you demand

Super User
Posts: 17,912

Re: Having count

Save the SAS program to a known location then and in your %INCLUDE change the path to wherever you saved the file. 

Ask a Question
Discussion stats
  • 8 replies
  • 295 views
  • 1 like
  • 4 in conversation