I will be generating a list of data on a daily basis and the count of data will vary. I would like to see how I can display 15% of the current count of data randomly.
To be more specific, I have a list of contacts that do not respond to the survey. I would like to follow up with 15% of the contacts daily. I would like the report to display only 15% of the contacts at random.
How would I go about completing this in Crystal Reports?
Would this work?
// (# Rnd}
// generate a random number between 0 and 14 (inclusive):
Floor(Rnd * 15)
Suppress details section when (#Rnd} <> 0
** edit **
Use this as the details section condition-suppression formula:
// generate a random number between 0 and 99 (inclusive); suppress all values > 14 (85%)
Floor(Rnd * 100) > 14
Try below approach:
Create a formula #reset and place in report header.
Shared Numbervar count;
count:=0
Place your contacts in details section.
Create a formula #count and place it to the rightmost part of the report.
Shared Numbervar count;
count:=count+1;
count;
Now go to the section expert of the Detail section and write below formula for supress condition.
EvaluateAfter(#Count);
Shared Numbervar count;
if (count mod 7)=0
then true
else false
This will make sure that for every 7 records there will be one record displayed and remaining will be supressed, this will be approximately 15 records displayed for every 100 records
Related
Hi, I would like to create a measure in power BI to return the number of times the terminal code appears in my list. The list is filtered from a slicer when I select the service code.
Thanks for any help! been stuck at this seemingly simple problem for a few days!
If you want to count occurence in selected filter context then use ALLSELECTED:
CountOfCode = CALCULATE( COUNTROWS(Sheet1), filter(ALLSELECTED(Sheet1), Sheet1[Terminal Code ] = SELECTEDVALUE(Sheet1[Terminal Code ]) ))
I am actually new to SAS and would like form portfolios between the intersection of 2 variables from my spreadsheet.
Basically, I have an excel file called 'Up' with variables in it like 'month, company, BM, market cap usd)
I would like to sort for each month my data: the size (descending) and then BM (descending). I would like to create 4 size portfolios according to P25, P50 and P75 with the first size portfolio being above P75 (for each month) and so on. Then for each size portfolio that was create recreating 4 new portfolios in function of 'BM' and also with P25, P50, and P75.
Could someone help me and display me the SAS code and the way to add it to my existing 'Up' file (name of the sheet is also named 'up')
So I agree with the comment, this is not asked well. However, it is a common problem to solve and somewhat fun. So here goes:
First I'm going to just make up some data. Google search how to read Excel in SAS. It's easy.
1000 companies with a random SIZE and BM value.
data companies(drop=c);
format company $12.;
do c=1 to 1000;
company = catt("C_",put(c,z4.));
size = ceil(100*ranuni(1));
BM = ceil(100*ranuni(1));
output;
end;
run;
So I'm assuming you just want equal amounts in these 4 groups. You don't want to estimate percentiles based on a distribution or KDE. For this, PROC RANK works well.
proc rank data=companies out=companies descending groups=4;
var size;
ranks p_size;
run;
We now have a variable P_SIZE that is values 0,1,2,3 based on the descending order of SIZE.
Sort the portfolios by that P_SIZE value.
proc sort data=companies;
by p_size;
run;
Now run PROC RANK again, this time using a BY statement with P_SIZE, ranking on BM, and creating P_SIZE_BM.
proc rank data=companies out=companies descending groups=4;
var bm;
by p_size;
ranks p_size_bm;
run;
P_SIZE_BM now contains values 0,1,2,3 for EACH value of P_SIZE.
Sort the data and see how it comes out:
proc sort data=companies;
by p_size p_size_bm;
run;
I am trying to select the top 10 exposures for each class of business out of a large data set.
Below is an example of the dataset.
dataset example
If I were to need the top 10 exposures then I would simply sort by exposure descending (as I have done) and use the (obs = 10) command.
However I require the top 10 for each LOB.
Do you know how I could do this in SAS?
Thanks!
I would create a counting dummy variable, counting the number of exposures per lines of business and then delete any observation for which the dummy variable exceeds 10.
This can be done in a single datastep (given that the data is properly sorted) by (ab-)using that SAS code runs top to bottom.
proc sort data = have out=temp; by lob descending exposure; run;
data want(drop=countlob);
retain countlob;
set temp;
by lob;
countlob = countlob + 1;
if first.lob then countlob = 1;
if countlob > 10 then delete;
run;
I am a beginner for Crystal report. I do not know how to work with formula editor.
My question is,
Table Name - Expenses
Field Name - Date, Purpose(Text), Less(Boolean), Amount(Double)
I want to count Less(Yes) Amount separately and Less(No) Amount separately. How to count this.
Please help me..
You will need two formulas:
Formula will show 1 for each record that has Less = True:
if less = True then 1
else 0
Formula 2 will show 1 for each record that has Less = False:
if less = False then 1
else 0
Now put those two formulas in your detail section and then do a sum on each one in your group footer. You can suppress the formulas in the detail section if you don't want to see them.
Hope that helps,
Chris
Ok, say I have a subreport that populates a chart I have from data in a table. I have a summary sum field that adds up the total of each row displayed. I am about to add two new rows that need to be displayed but not totaled up in the sum. There is a field in the table that has a number from 1-7 in it. If I added these new fields into the database, I would assign a negative number to this like -1 and -2 to differentiate it between the other records. How can I set up a formula so that it will sum up all of the amount fields except for the records that have an 'order' number we will call it of either -1 or -2? Thanks!
Use a Running Total Field and set the evaluate formula to something like {new_field} >= 0. So it will only sum the value when it passes that test.
The way to accomplish this without a running total is with a formula like this:
if {OrderNum} >= 0 Then {Amount}