BookmarkSubscribeRSS Feed
Keets
Calcite | Level 5

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.

asdf2.png

asdf.png

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

1 REPLY 1
Reeza
Super User

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.

asdf2.png

asdf.png

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


 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to connect to databases in SAS Viya

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.

Discussion stats
  • 1 reply
  • 694 views
  • 0 likes
  • 2 in conversation