Two sample T-Test in SAS - sas

I am trying to run a campaign analysis. I have two campaigns A and B and I have their sample size and response rates.
Data structure:
Campaign_Name Response_Flag
A 0
A 1
A 1
B 1
B 0
I have summarized to get a response rate and sample size
Campaign_name Sample_size Response Rate
A 6500 0.7%
B 3600 1.2%
I want to see if the two campaigns are statistically similar or different .
Please help !!
Thanks

Related

Two sided test: proc ttest?

I need to calculate the two-sided ttest in SAS.
I generally use the proc ttest adding side=2 but I am not sure if this test works fine or if another way should be preferred to it.
An example of data is the following:
Score Segment Obs Class_obs
1 0 500 15
1 1 500 34
2 0 234 23
2 1 766 65
Where the p-value is calculated per each score. Segment means that a condition is met (e.g. score higher than 60. 0 means ‘lower than 60’ while 1 means ‘higher than 60’).
Obs is the number of observations in each segment by score. Class obs is the number of obs that satisfy a specific condition on the overall population.
Happy to share more info if it needs.

How do you rank based on a measure referencing two tables in a star schema?

I have a star schema data model. DimDate, DimBranchName, BranchActual, BranchBudget.
I have measures to calculate the YTD variance to Budget by Branch called QVar. Qvar takes the counts from BranchActual and compares it BranchBudget between two dates. The visual is controlled by DimBranchName and DimDate.
Current Result:
BranchName YTDActual YTDBudget QVar
A 100 150 (33%)
B 200 200 0.0%
C 25 15 66%
I want a measure to be able to rank DimBranchName[BranchName] by QVar that will interact with the filters I have in place.
Desired result:
BranchName YTDActual YTDBudget QVar Rank
A 100 150 (33%) 3
B 200 200 0.0% 2
C 25 15 66% 1
What I've tried so far is
R Rank of Actual v Goal =
var V = [QVar]
RETURN
RANKX(ALLSELECTED('BranchActual'),CALCULATE(V),,ASC,Dense)
What I get is all 1's
BranchName YTDActual YTDBudget QVar Rank
A 100 150 (33%) 1
B 200 200 0.0% 1
C 25 15 66% 1
Thanks!
When you declare a variable it is computed once and treated as a constant through the rest of your DAX code, so CALCULATE(V) is simply whatever V was when you declared the variable.
This might be closer to what you want:
R Rank of Actual v Goal =
RANKX ( ALLSELECTED ( DimBranchName[BranchName] ), [QVar],, ASC, DENSE )
This way [QVar] is called within the filter context of the BranchName instead of being a constant. (Note that referencing a measure within another measure implicitly wraps it in CALCULATE so you don't need that again.)

replicate a SQL report in powerbi - create 2 queries and merge them to get result

I am trying to create a report in power BI where I have to create one query which creates 30 calculated columns, then merge it with another query with left outer join to get my results. I am using measures to do my calculations to create the 30 columns and when I bring them together in report view, I lose my results from the second query.
I tried to create calculated columns in a new table to store results but since all calculations do a distinct count of account numbers, I am unable to put results in the same table, so I used measures to do my calculations.
Cannot post the code online :(
Expected result:
School name Code Col1 Col2 Col2
a ABC 1000 0 0
b BBB 2000 2000 2000
c AAB 0 0 0
d NNN 4000 4000 0
e ACE 0 0 0
Getting this result
School name Code Col1 Col2 Col2
a ABC 1000 0 0
b BBB 2000 2000 2000
d NNN 4000 4000 0

WEKA: Print the Indexes of Test data instances w.r.t original data at the time of cross validation

I have a query about the indexes of test data instances chosen by weka at the time of cross validation. How to print the indexes of the test data instances which are being evaluated ?
==================================
I have chosen:
Dataset : iris.arff
Total instances : 150
Classifier : J48
cross validation: 10 fold
I have also made output prediction as "PlainText"
=============
In the output window I can see like this :-
inst# actual predicted error prediction
1 3:Iris-virginica 3:Iris-virginica 0.976
2 3:Iris-virginica 3:Iris-virginica 0.976
3 3:Iris-virginica 3:Iris-virginica 0.976
4 3:Iris-virginica 3:Iris-virginica 0.976
5 3:Iris-virginica 3:Iris-virginica 0.976
6 1:Iris-setosa 1:Iris-setosa 1
7 1:Iris-setosa 1:Iris-setosa 1
....
...
...
Total 10 test data set.(15 instances in each).
======================
As WEKA uses startified cross validation, instances in the test data sets are randomly choosen.
So, How to print the indexes of test data w.r.t the data in original file?
i.e
inst# actual predicted error prediction
1 3:Iris-virginica 3:Iris-virginica 0.976
This result is for which instance in main data (among total 50 Iris-virginica) ?
===============
After a lot of search, I have found that the below youtube video is helpful for the above problem.
Hope this will be helpful for any future visitor with same queries.
Weka Tutorial 34: Generating Stratified Folds (Data Preprocessing)

Informatica report query

Please find the below requirement,i tried with route and a sort and aggregator but amnt getting the actual output
Source records
ID type amount desc
1 Credit 300 xyz
2 Debit 100 abc
1 Credit 400 xyz
1 Debit 500 xyz
1 Debit 200 xyz
2 Credit 200 abc
Result
1 Credit 300 xyz
1 Credit 400 xyz
1 Debit 700 ( total of 1 credit & des is null)
1 Debit 500 abc
1 Debit 200 abc
1 Credit 700
2 Credit 200 abc
2 Debit 200
2 Debit 100 abc
2 Credit 100
You could create a mapping with 2 branches:
The first branch simply passes the records without any change to data
The second branch aggregates amounts grouping by ID and Type
You can then put a Union to get all records together, then a Sorter on the same keys, ID and Type, to get data in the right order for the Target.
The mapping would look like this:
Source -> Expression -> Union -> Sorter -> Target
+-> Aggregator --^