In this post, we will see how to resolve add counter of values for only 1 record in sql/sas
Question:
Hello every one i have a table with only 1 record i want to count the number of times a particular value is there (counter) eg in table 1 we have 3 goals in table2 we have from goal1 to goal 3 ,similarly for current state

Best Answer:
This code will calculate it using by-group processing, so you don’t need to worry about keeping track of the unique words within each column. First, transpose it to a long format and sort it by word:order
to get it back into the original order, then transpose it back to the desired format.If you have better answer, please add a comment about this, thank you!
Source: Stackoverflow.com