How to use proc means in SAS to calculate the mean of a value and divide it by 12 (so it would show up in a table) - sas

I know how to find the mean but haven't found a way to divide it by some kind of number.
what it looks like: (how to divide all the number values by 12?)
inserted a pic of how i got it:

Related

DAX function to count total number of times an order number appears in a data table given a list of the unique order numbers

I have a set of orders, each order has between 1 and 30 or so serial numbers in the order. The dataset has a row for each serial number, so sometimes the order number is repeated, as many times as there are serial numbers. I also have a table of all of the distinct order numbers, and I am looking to count how many serial numbers each order has. The serial numbers are "located" in different places, which meant I could not just sum them all up.
Here is a snippet of the main data table with the order number on the left and serial numbers on the right
I've tried a few functions that are supposed to mimic SUMIF but I am either only able to get 0 or the sum of ALL of the serial numbers.
Here is the most recent thing I've tried, as well as the list of unique order numbers
Here is my data model
Here is the result when I tried the measure suggested
You can achieve it in a simple way! As far as I can understand, you have a model like this:
Then create a simple measure like this:
QtyInWorkOrder = COUNT(ListOfWorkOrders[SERIAL_NUM])
Then Test it on a table visual:
Put ORDER_NUMBER field on the ORDERS table into row field, Above measure into values field, Then final report looks like:
Note: I partly copied your data!so actual result will look different on your report!
I hope This solves your problem!
Update:
Create a new measure and put it into your description! See picture below!
or
Just put calculate in your formula:
QtyInWorkOrder = CALCULATE(COUNT(ListOfWorkOrders[SERIAL_NUM]))

How do I convert a number from data type TEXT to whole number to further calculate it using DAX?

I am taking data from the excel where there is a column "Global" with values as whole numbers and decimal numbers. When I am importing it to Power BI, the column data type is coming as "TEXT" and hence I am unable to use it to calculate my new column which is "Local + Global / Total" since it cannot convert calculate on string which makes complete sense.
I looked it up and tried the following :
To change the column type to Whole Number / Decimal Number and it showed me an error that It cannot be converted.
I made a measure using the functions CONVERT and VALUE but in vain. It could not be converted saying a single value was expected but multiple values were provided in the latter.
How do I solve this?
EDIT
The column looks like this
Global
12345.67
43566
123.765
If it is showing error that It cannot be converted, obviously there are some garbage value in the column like - space, string or other values not a number. Please check your data first, hope you will get the issue as well.
In Power Query Editor You can select the column and change data type to Whole Number. In that case, some errors will be shown where the conversion failed to convert some value as shown below-
Here I have provided a string in the last row. Now you can check your data by filtering the column with error to check what are the actual values in the source. You can than perform some transformation to get the correct value value out of them.
You can also remove all records with error as shown below if you find those rows are with garbage value is not important for your.

Power BI DAX - Running the MEDIAN or MEDIANX formula for a calculated column gives error message

I have been trying to generate a calculated column within Power BI Desktop using the MEDIAN formula to get the median age. I checked to see if there were any inconsistencies like text data or blank data within the Age column but, did not find any such instances. The error message is as follows -
Expressions that yield variant data-type cannot be used to define
calculated columns.
The data used in the analysis is hosted on data.world
Any help will be highly appreciated.
This is a pretty strange situation but I think I found the explanation on the Microsoft Community Forum.
When the underlying column is of data type Whole Number, MEDIAN function returns a variant data type because it may return a Whole Number when there is no interpolation or a Decimal Number when there is interpolation. While measures can be of variant data type, calculated columns must be of a single data type, hence the error. To force MEDIAN to always return Decimal Number, change the expression to MEDIANX(Table1, [Column2] * 1.0).
Another fix would be to convert the Age column to the decimal number type rather than the whole number type. I also found wrapping with VALUE work.

SAS max function result

Had a look at SAS documentation and around SO, but being a bit distant from the field and SAS specifically, wanted to ask for help.
I am looking at some SAS code, where this specific part is of interest:
SELECT A.*,
CASE WHEN A.all_111 > max(99.99, 0.025*AMOUNT)
This runs before a table of entries is created. The table is supposed to discard values below 100. I am presuming that's what the first argument (99.99) in max does.
However, I am not sure what is the purpose of 0.025*AMOUNT?
The max simply takes the maximum of 99.99 and 0.025* amount, which is 2.5% of the amount. So if 2.5% of the amount is more than 100 then it can be higher than 100. Max would be operating on each individual row value here.

How can I discretize a set of values in WEKA?

I have a set of integer values from 1 to 50 and I´d like to discretize this set in order to work with ranges instead of individual values (they are a huge amount of numbers for a decision tree). Let´s say I want a range from 1 to 25 and another range from 26 to 50. I´ ve tried with the Discretize filter but I don´t get anything to work.
Do you know how to do this in WEKA?
Thank you in advance
Try to set them as I did in this screenshot:
Here I used the ionosphere.arff dataset. AttributeIndecices "1" means "column 1".