BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RuthE
Calcite | Level 5
 
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
tagawa_sas
Fluorite | Level 6

Hello Ruth,


I believe that we are in the same SAS class! As previously stated, your code creates a variable that is never assigned a value, so I think that all your formats were deleted somehow. I would first try to use the formats in general, then if that didn't work then I would create the formats again.

 

To do this, you would need to create an excel sheet that is titled "Data Map - Hypertension Study.xlsx", in addition to having a spreadsheet in this titled "Format Control Sheet". In the sheet you could copy and paste the table that I have listed below, which has all the formats in the appropriate way I believe.

 

%LET CourseRoot = *Whatever your course root is*;
LIBNAME HypTabs "&CourseRoot/Hypertension Study/Data/3_Tabulations";
LIBNAME HypImpt "&CourseRoot/Hypertension Study/Data/2_Import";


LIBNAME HypFmts XLSX "&CourseRoot\Hypertension Study\Documents\Data Map - Hypertension Study.xlsx";
PROC FORMAT
CNTLIN = HypFmts.'Format Control Sheet'N
LIBRARY = HypTabs.HypFormats;
RUN;

 

FMTNAMETYPEHLOSTARTENDSEXCLEEXCLLABEL
CODCdN 11  Heart Disease
CODCdN 22  Heart Failure
CODCdN 33  Stroke
CODCdN 44  Other COD
DBPHypCatsNL 60 YBelow Normal
DBPHypCatsN 6080 YNormal
DBPHypCatsN 8090 YHigh Normal
DBPHypCatsN 90100 YStage 1 Hypertension
DBPHypCatsN 100110 YStage 2 Hypertension
DBPHypCatsNH110   Stage 3 Hypertension
DBPHypYNNL 90 YNo Hypertension
DBPHypYNNH90   Hypertension
GenderCdN 11  Male
GenderCdN 22  Female
IndVblN 00  No
IndVblN 11  Yes
SBPHypCatsNL 90 YBelow Normal
SBPHypCatsN 90120 YNormal
SBPHypCatsN 120140 YHigh Normal
SBPHypCatsN 140160 YStage 1 Hypertension
SBPHypCatsN 160180 YStage 2 Hypertension
SBPHypCatsNH180  YStage 3 Hypertension
SBPHypYNNL 140 YNo Hypertension
SBPHypYNNH140   Hypertension
EthCdC HH  Hispanic
EthCdC NN  Non-Hispanic
EthRaceCdC HISHIS  Hispanic
EthRaceCdC NHANHA  NH Asian
EthRaceCdC NHBNHB  NH Black
EthRaceCdC NHONHO  NH Other Race
EthRaceCdC NHWNHW  NH White
RaceCdC AA  Asian
RaceCdC BB  Black
RaceCdC OO  Other Race
RaceCdC WW  White
StateCdC IAIA  Iowa
StateCdC MSMS  Mississippi
StateCdC UTUT  Utah

 

Hope this helps,
Alex

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

How were the formats created? Please post that code.

Do the types of the variables correspond to the types of the formats?

 

Your code creates a variable that is never assigned a value.

You will have to re-sort your datasets.

 

When posting logs, always include the whole code, not just the messages.

tagawa_sas
Fluorite | Level 6

Hello Ruth,


I believe that we are in the same SAS class! As previously stated, your code creates a variable that is never assigned a value, so I think that all your formats were deleted somehow. I would first try to use the formats in general, then if that didn't work then I would create the formats again.

 

To do this, you would need to create an excel sheet that is titled "Data Map - Hypertension Study.xlsx", in addition to having a spreadsheet in this titled "Format Control Sheet". In the sheet you could copy and paste the table that I have listed below, which has all the formats in the appropriate way I believe.

 

%LET CourseRoot = *Whatever your course root is*;
LIBNAME HypTabs "&CourseRoot/Hypertension Study/Data/3_Tabulations";
LIBNAME HypImpt "&CourseRoot/Hypertension Study/Data/2_Import";


LIBNAME HypFmts XLSX "&CourseRoot\Hypertension Study\Documents\Data Map - Hypertension Study.xlsx";
PROC FORMAT
CNTLIN = HypFmts.'Format Control Sheet'N
LIBRARY = HypTabs.HypFormats;
RUN;

 

FMTNAMETYPEHLOSTARTENDSEXCLEEXCLLABEL
CODCdN 11  Heart Disease
CODCdN 22  Heart Failure
CODCdN 33  Stroke
CODCdN 44  Other COD
DBPHypCatsNL 60 YBelow Normal
DBPHypCatsN 6080 YNormal
DBPHypCatsN 8090 YHigh Normal
DBPHypCatsN 90100 YStage 1 Hypertension
DBPHypCatsN 100110 YStage 2 Hypertension
DBPHypCatsNH110   Stage 3 Hypertension
DBPHypYNNL 90 YNo Hypertension
DBPHypYNNH90   Hypertension
GenderCdN 11  Male
GenderCdN 22  Female
IndVblN 00  No
IndVblN 11  Yes
SBPHypCatsNL 90 YBelow Normal
SBPHypCatsN 90120 YNormal
SBPHypCatsN 120140 YHigh Normal
SBPHypCatsN 140160 YStage 1 Hypertension
SBPHypCatsN 160180 YStage 2 Hypertension
SBPHypCatsNH180  YStage 3 Hypertension
SBPHypYNNL 140 YNo Hypertension
SBPHypYNNH140   Hypertension
EthCdC HH  Hispanic
EthCdC NN  Non-Hispanic
EthRaceCdC HISHIS  Hispanic
EthRaceCdC NHANHA  NH Asian
EthRaceCdC NHBNHB  NH Black
EthRaceCdC NHONHO  NH Other Race
EthRaceCdC NHWNHW  NH White
RaceCdC AA  Asian
RaceCdC BB  Black
RaceCdC OO  Other Race
RaceCdC WW  White
StateCdC IAIA  Iowa
StateCdC MSMS  Mississippi
StateCdC UTUT  Utah

 

Hope this helps,
Alex

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 638 views
  • 0 likes
  • 3 in conversation