Hi,
I get an error message that I don't understand when I use the SAS CALMAR macro to calculate the weights. I read the documentation and apply it but it doesn't work. Even the example given in the documentation does not work for us.
Here is my data and the Squid macro. Can anyone help me or someone who has already used this SAS Calmar macro can explain to me what is wrong in my code or if I forgot a line of code before running the macro SAS CALMAR.
Thanks in advance.
Gick
data BDD_recod;
input Nom $ sexe $ X $ Pond ;
datalines;
Jean Masculin 0-4ans 10
Marie Feminin 5-14ans 10
Pierre Masculin 15-24ans 10
J Feminin 0-4ans 10
M Feminin 5-14ans 10
Pe Masculin 0-4ans 10
Je Masculin 15-24ans 10
Ma Masculin 0-4ans 10
Pire Feminin 25-30ans 10
Mfir Feminin 35-40ans 10
Pell Masculin 40-45ans 10
Jeurs Masculin 15-24ans 10
Mam Masculin 0-4ans 10
Piress Feminin 15-24ans 10
;
data marges_cibles;
input VAR $ N MAR1-MAR6 ;
Cards;
sexe 2 67866 80149 . . . .
X 6 33065.5 39023 35281 21382 11561 7702
;
%CALMAR(DATA=BDD_recod, POIDS=Pond, IDENT=Nom, DATAMAR=marges_cibles, M=2,EDITPOI=OUI,OBSELI=OUI,DATAPOI=SORTIE,POIDSFIN=PONDFIN,LABELPOI=pondération raking ratio)
That page seems to only have SAS CATALOG files. They MIGHT have a COMPILED version of the macro. But compiled SAS macros are not PORTABLE.
But it does have a link to a GITHUB repository, https://github.com/InseeFr/Calmar/blob/main/Calmar.sas , where you can get the actual macro definition.
But the %MACRO statement in that code file has the / STORE option on it which cause attempts to compile to fail with this error message:
ERROR: The MSTORED option must be set to use the /STORE macro statement option. ERROR: A dummy macro will be compiled.
So first REMOVE that /STORE option.
Then compile the macro.
Then try the examples.
You might also have trouble with the character set used in the macro definition. And of course the documentation all appears to be in French.
Un petit exemple de calage sur marges 12:14 Thursday, September 28, 2023 8 ********************************** *** Param?tres de la macro *** ********************************** Table en entr?e DATA = DON Pond?ration initiale POIDS = POND Pond?ration Qk PONDQK = __UN Identifiant IDENT = NOM Table des marges DATAMAR = MARGES Marges en pourcentages PCT = NON Effectif de la population EFFPOP = M?thode utilis?e M = 2 Borne inf?rieure LO = Borne sup?rieure UP = Seuil d'arr?t SEUIL = 0.0001 Nombre maximum d'it?rations MAXITER = 15 Table contenant la pond. finale DATAPOI = SORTIE Mise ? jour de la table DATAPOI MISAJOUR = OUI Pond?ration finale POIDSFIN = PONDFIN Label de la pond?ration finale LABELPOI = pondération raking ratio Contenu de la table DATAPOI CONTPOI = OUI Edition des poids EDITPOI = OUI Statistiques sur les poids STAT = OUI Contr?les CONT = OUI Table contenant les obs. ?limin?es OBSELI = OUI Notes SAS NOTES = NON
When you get an error in the code, SHOW US the log. We need to see the ENTIRE log for the PROC or DATA step that has the error.
Since you get an error in a macro, please turn on the macro debugging option by running this line of code and then run the macro again, and then show us the log for this PROC or DATA step that has the error.
options mprint;
Copy the log for the PROC or DATA step that has the error and paste it into the window that appears when you click on the </> icon.
Also, it would help if you gave us a link to the CALMAR macro.
@Gick wrote:
I just applied the example given in the macro documentation. I don't know why this isn't working for me.
I asked to see the log, I gave specific details on what I want to see and how to present it. Thanks!
That page seems to only have SAS CATALOG files. They MIGHT have a COMPILED version of the macro. But compiled SAS macros are not PORTABLE.
But it does have a link to a GITHUB repository, https://github.com/InseeFr/Calmar/blob/main/Calmar.sas , where you can get the actual macro definition.
But the %MACRO statement in that code file has the / STORE option on it which cause attempts to compile to fail with this error message:
ERROR: The MSTORED option must be set to use the /STORE macro statement option. ERROR: A dummy macro will be compiled.
So first REMOVE that /STORE option.
Then compile the macro.
Then try the examples.
You might also have trouble with the character set used in the macro definition. And of course the documentation all appears to be in French.
Un petit exemple de calage sur marges 12:14 Thursday, September 28, 2023 8 ********************************** *** Param?tres de la macro *** ********************************** Table en entr?e DATA = DON Pond?ration initiale POIDS = POND Pond?ration Qk PONDQK = __UN Identifiant IDENT = NOM Table des marges DATAMAR = MARGES Marges en pourcentages PCT = NON Effectif de la population EFFPOP = M?thode utilis?e M = 2 Borne inf?rieure LO = Borne sup?rieure UP = Seuil d'arr?t SEUIL = 0.0001 Nombre maximum d'it?rations MAXITER = 15 Table contenant la pond. finale DATAPOI = SORTIE Mise ? jour de la table DATAPOI MISAJOUR = OUI Pond?ration finale POIDSFIN = PONDFIN Label de la pond?ration finale LABELPOI = pondération raking ratio Contenu de la table DATAPOI CONTPOI = OUI Edition des poids EDITPOI = OUI Statistiques sur les poids STAT = OUI Contr?les CONT = OUI Table contenant les obs. ?limin?es OBSELI = OUI Notes SAS NOTES = NON
What is the error message you receive?
You could have missed a semicolon or compiled the macro wrong....in fact your code doesn't show the macro compilation step.
Which is why we need to see the log.
@Gick wrote:
Hi,
I get an error message that I don't understand when I use the SAS CALMAR macro to calculate the weights. I read the documentation and apply it but it doesn't work. Even the example given in the documentation does not work for us.
Here is my data and the Squid macro. Can anyone help me or someone who has already used this SAS Calmar macro can explain to me what is wrong in my code or if I forgot a line of code before running the macro SAS CALMAR.
Thanks in advance.
Gick
data BDD_recod; input Nom $ sexe $ X $ Pond ; datalines; Jean Masculin 0-4ans 10 Marie Feminin 5-14ans 10 Pierre Masculin 15-24ans 10 J Feminin 0-4ans 10 M Feminin 5-14ans 10 Pe Masculin 0-4ans 10 Je Masculin 15-24ans 10 Ma Masculin 0-4ans 10 Pire Feminin 25-30ans 10 Mfir Feminin 35-40ans 10 Pell Masculin 40-45ans 10 Jeurs Masculin 15-24ans 10 Mam Masculin 0-4ans 10 Piress Feminin 15-24ans 10 ; data marges_cibles; input VAR $ N MAR1-MAR6 ; Cards; sexe 2 67866 80149 . . . . X 6 33065.5 39023 35281 21382 11561 7702 ; %CALMAR(DATA=BDD_recod, POIDS=Pond, IDENT=Nom, DATAMAR=marges_cibles, M=2,EDITPOI=OUI,OBSELI=OUI,DATAPOI=SORTIE,POIDSFIN=PONDFIN,LABELPOI=pondération raking ratio)
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.