Statistical programming, matrix languages, and more

comparing the values of 2 groups of variables in the same data set as plausibility check

Reply
Contributor
Posts: 57

comparing the values of 2 groups of variables in the same data set as plausibility check

Hi,

I've put the same post unter data step and macro section as well. But since the outcome should be a matrix, I will just try to look for suggestions here as well. So far I've only got a bit experience with data step, sql and macros and not at all with IML. So I dont really know if this is the right place to put my quesiton.

The situation is:

I want to compare the values of 2 groups of variables in the same data set "work.have". I've saved the two groups of variables in two macro variables &gIS and &gSHOULD with proc sql. Each group has 40 variables and each variable has 60 observations (persons). The data was sorted, so the counterparty of the 1st variable in gIS is just the 1st variable in gSHOULD and so on. The aim is to do a plausibility check. If the data was right, then the values of the variables in gIS should be bigger than the ones in gSHOULD.

What i want to get is a dataset with 61 rows and 41 columns that looks like this:

Header 1Comparison Var1 from gIS with Var1 from gSHOULDComparison Var2 from gIS with Var2 from gSHOULDComparison Var3 from gIS with Var3 from gSHOULD
Person 1000
Person 2100
Person 3010

The headers are a bit awkward. I think i have to name them another way. but the aim is to have a '0', where the condition gIS>gSHOULD got satisfied and 1 otherwise. So the '1' is like a warning, that sth. is wrong with the data there.

I've only worked with vectors before and since the outcoming is actually a matix, I dont know how to write my script.

I hope I made my task clear. Any help is very much appreciated!!

BR  Dingdang

Ask a Question
Discussion stats
  • 0 replies
  • 282 views
  • 0 likes
  • 1 in conversation