Hello,
I have a big dataset with 3 values that are of interest. ID, Visite and WSL_Flaechen.
Visite ranges from 1 to 5 and WSL_Flaechen from 1 to 2.
With the following code i managed to group by Visite and count the WSL_Flaechen for each ID.
But instead i want count of WSL_Flaechen (blue arrow) to be multiplied with the value of WSL_Flaechen (red arrow) and display the sum of that for each ID.
So ID 4001 has
(1*8 + 2*12) = 32 on Visite 1 and
2 + 20 = 22 on Visite 2
and 26 on Visite 3
and so on...
The dataset only has 1s and 2s and the WSL_Flaechen field and i cant seem to just sum them up. I only display the count of 1s and 2s in seperate fields. How to i properly use the sum function here?
When i try to get sum in there i get the "statistical variable other than N without analysis variable" error.
Sincerely,
Keets
Look at the WEIGHT or FREQ statement within the PROC instead - and double check your numbers, especially if you have any missing values or non integers.
@Keets wrote:
Hello,
I have a big dataset with 3 values that are of interest. ID, Visite and WSL_Flaechen.
Visite ranges from 1 to 5 and WSL_Flaechen from 1 to 2.
With the following code i managed to group by Visite and count the WSL_Flaechen for each ID.
But instead i want count of WSL_Flaechen (blue arrow) to be multiplied with the value of WSL_Flaechen (red arrow) and display the sum of that for each ID.
So ID 4001 has
(1*8 + 2*12) = 32 on Visite 1 and
2 + 20 = 22 on Visite 2
and 26 on Visite 3
and so on...
The dataset only has 1s and 2s and the WSL_Flaechen field and i cant seem to just sum them up. I only display the count of 1s and 2s in seperate fields. How to i properly use the sum function here?
When i try to get sum in there i get the "statistical variable other than N without analysis variable" error.
Sincerely,
Keets
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.