337.ANALYTICAL PROGRAM FOR SPACE INVENTIONS USING PROC SQL | PROC MEANS | PROC FREQ | PROC FORMAT | PROC SORT | PROC PRINT | MACRO PROCESSING WITH INTCK | INTNX DATE FUNCTIONS

ANALYTICAL PROGRAM FOR SPACE INVENTIONS USING PROC SQL | PROC MEANS | PROC FREQ | PROC FORMAT | PROC SORT | PROC PRINT | MACRO PROCESSING WITH INTCK | INTNX DATE FUNCTIONS

 options nocenter;

1.PROC FORMAT FOR SUCCESS LEVEL

proc format;

    value $successfmt

        "High"   = "Highly Successful"

        "Medium" = "Moderately Successful"

        "Low"    = "Low Success"

        other    = "Unknown";

run;

LOG:

NOTE: Format $SUCCESSFMT has been output.

2.MACRO FOR IMPORTANCE GROUPING

%macro importance_macro(var=, outvar=);

    if strip(&var) = "High" then &outvar = "Critical";

    else if strip(&var) = "Medium" then &outvar = "Significant";

    else &outvar = "Minor";

%mend importance_macro;


3.CREATE DATASET: SPACE INVENTIONS                              

data space_inventions;

    length Invention_Name $40 Inventor $40 Country $30 Usage $50 Success_Level $10;

    informat Invent_Date Review_Date date9.;

    format   Invent_Date Review_Date date9.;

    input Invention_Name :$40. Inventor:$40. Year Country:$30. Usage:$50.

        Success_Level:$10. Invent_Date:date9. Review_Date:date9.;

datalines;

Satcom ArthurCClarke 1964 UK Communication High 01JAN1964 01FEB1964

LunarModule NASA 1969 USA Landing Medium 15JUL1969 10AUG1969

GPS Pentagon 1978 USA Navigation High 01JAN1978 15JAN1978

SpaceShuttle NASA 1981 USA Transport High 12APR1981 20APR1981

MarsRover JPL 1997 USA Exploration High 04JUL1997 15JUL1997

HubbleTelescope ESA 1990 EU Observation High 24APR1990 01MAY1990

Sputnik Satellite 1957 USSR Communication Medium 04OCT1957 20OCT1957

ISS NASA_Roscosmos 1998 International Research High 20NOV1998 10DEC1998

CryogenicEngine ISRO 2014 India Propulsion High 05JAN2014 25JAN2014

ReusableRocket SpaceX 2015 USA Transport High 22DEC2015 10JAN2016

ChandrayaanOrbiter ISRO 2008 India Exploration Medium 22OCT2008 15NOV2008

SolarSail JAXA 2010 Japan Propulsion Low 21MAY2010 18JUN2010

;

run;

proc print data=space_inventions;

run;

OUTPUT:

ObsInvention_NameInventorCountryUsageSuccess_LevelInvent_DateReview_DateYear
1SatcomArthurCClarkeUKCommunicationHigh01JAN196401FEB19641964
2LunarModuleNASAUSALandingMedium15JUL196910AUG19691969
3GPSPentagonUSANavigationHigh01JAN197815JAN19781978
4SpaceShuttleNASAUSATransportHigh12APR198120APR19811981
5MarsRoverJPLUSAExplorationHigh04JUL199715JUL19971997
6HubbleTelescopeESAEUObservationHigh24APR199001MAY19901990
7SputnikSatelliteUSSRCommunicationMedium04OCT195720OCT19571957
8ISSNASA_RoscosmosInternationalResearchHigh20NOV199810DEC19981998
9CryogenicEngineISROIndiaPropulsionHigh05JAN201425JAN20142014
10ReusableRocketSpaceXUSATransportHigh22DEC201510JAN20162015
11ChandrayaanOrbiterISROIndiaExplorationMedium22OCT200815NOV20082008
12SolarSailJAXAJapanPropulsionLow21MAY201018JUN20102010


4.ADD IMPORTANCE GROUP USING MACRO                             

data inventions_with_importance;

    set space_inventions;

    length Importance_Group $20;

    %importance_macro(var=Success_Level, outvar=Importance_Group);

run;

proc print data=inventions_with_importance;

run;

OUTPUT:

ObsInvention_NameInventorCountryUsageSuccess_LevelInvent_DateReview_DateYearImportance_Group
1SatcomArthurCClarkeUKCommunicationHigh01JAN196401FEB19641964Critical
2LunarModuleNASAUSALandingMedium15JUL196910AUG19691969Significant
3GPSPentagonUSANavigationHigh01JAN197815JAN19781978Critical
4SpaceShuttleNASAUSATransportHigh12APR198120APR19811981Critical
5MarsRoverJPLUSAExplorationHigh04JUL199715JUL19971997Critical
6HubbleTelescopeESAEUObservationHigh24APR199001MAY19901990Critical
7SputnikSatelliteUSSRCommunicationMedium04OCT195720OCT19571957Significant
8ISSNASA_RoscosmosInternationalResearchHigh20NOV199810DEC19981998Critical
9CryogenicEngineISROIndiaPropulsionHigh05JAN201425JAN20142014Critical
10ReusableRocketSpaceXUSATransportHigh22DEC201510JAN20162015Critical
11ChandrayaanOrbiterISROIndiaExplorationMedium22OCT200815NOV20082008Significant
12SolarSailJAXAJapanPropulsionLow21MAY201018JUN20102010Minor


5.PROC SQL EXAMPLE                                              

proc sql;

    create table invention_summary as

    select Country,

           count(*) as Total_Inventions,

           mean(Year) as Avg_Year

    from space_inventions

    group by Country;

quit;

proc print data=invention_summary;

run;

OUTPUT:

ObsCountryTotal_InventionsAvg_Year
1EU11990
2India22011
3International11998
4Japan12010
5UK11964
6USA51988
7USSR11957


6.USING INTCK & INTNX FOR DATE INTERVAL ANALYSIS               

data date_analysis;

    set space_inventions;

    Days_Between = intck('day', Invent_Date, Review_Date);

    Next_Review  = intnx('month', Review_Date, 6, 'same');

    format Next_Review date9.;

run;

proc print data=date_analysis;

run;

OUTPUT:

ObsInvention_NameInventorCountryUsageSuccess_LevelInvent_DateReview_DateYearDays_BetweenNext_Review
1SatcomArthurCClarkeUKCommunicationHigh01JAN196401FEB196419643101AUG1964
2LunarModuleNASAUSALandingMedium15JUL196910AUG196919692610FEB1970
3GPSPentagonUSANavigationHigh01JAN197815JAN197819781415JUL1978
4SpaceShuttleNASAUSATransportHigh12APR198120APR19811981820OCT1981
5MarsRoverJPLUSAExplorationHigh04JUL199715JUL199719971115JAN1998
6HubbleTelescopeESAEUObservationHigh24APR199001MAY19901990701NOV1990
7SputnikSatelliteUSSRCommunicationMedium04OCT195720OCT195719571620APR1958
8ISSNASA_RoscosmosInternationalResearchHigh20NOV199810DEC199819982010JUN1999
9CryogenicEngineISROIndiaPropulsionHigh05JAN201425JAN201420142025JUL2014
10ReusableRocketSpaceXUSATransportHigh22DEC201510JAN201620151910JUL2016
11ChandrayaanOrbiterISROIndiaExplorationMedium22OCT200815NOV200820082415MAY2009
12SolarSailJAXAJapanPropulsionLow21MAY201018JUN201020102818DEC2010


7.PROC MEANS                                                    

proc means data=date_analysis n mean min max;

    var Days_Between Year;

run;

OUTPUT:

The MEANS Procedure

VariableNMeanMinimumMaximum
Days_Between
Year
12
12
18.6666667
1990.08
7.0000000
1957.00
31.0000000
2015.00

8.PROC FREQ                                                    

proc freq data=inventions_with_importance;

    tables Country Success_Level Importance_Group;

    format Success_Level $successfmt.;

run;

OUTPUT:

The FREQ Procedure

CountryFrequencyPercentCumulative
Frequency
Cumulative
Percent
EU18.3318.33
India216.67325.00
International18.33433.33
Japan18.33541.67
UK18.33650.00
USA541.671191.67
USSR18.3312100.00
Success_LevelFrequencyPercentCumulative
Frequency
Cumulative
Percent
Highly Successful866.67866.67
Low Success18.33975.00
Moderately Successful325.0012100.00
Importance_GroupFrequencyPercentCumulative
Frequency
Cumulative
Percent
Critical866.67866.67
Minor18.33975.00
Significant325.0012100.00

9.ADDITIONAL PROC SORT & PRINT               |

proc sort data=inventions_with_importance out=sorted_inventions;

    by Country Year;

run;

proc print data=sorted_inventions;

run;

OUTPUT:

ObsInvention_NameInventorCountryUsageSuccess_LevelInvent_DateReview_DateYearImportance_Group
1HubbleTelescopeESAEUObservationHigh24APR199001MAY19901990Critical
2ChandrayaanOrbiterISROIndiaExplorationMedium22OCT200815NOV20082008Significant
3CryogenicEngineISROIndiaPropulsionHigh05JAN201425JAN20142014Critical
4ISSNASA_RoscosmosInternationalResearchHigh20NOV199810DEC19981998Critical
5SolarSailJAXAJapanPropulsionLow21MAY201018JUN20102010Minor
6SatcomArthurCClarkeUKCommunicationHigh01JAN196401FEB19641964Critical
7LunarModuleNASAUSALandingMedium15JUL196910AUG19691969Significant
8GPSPentagonUSANavigationHigh01JAN197815JAN19781978Critical
9SpaceShuttleNASAUSATransportHigh12APR198120APR19811981Critical
10MarsRoverJPLUSAExplorationHigh04JUL199715JUL19971997Critical
11ReusableRocketSpaceXUSATransportHigh22DEC201510JAN20162015Critical
12SputnikSatelliteUSSRCommunicationMedium04OCT195720OCT19571957Significant


10.BASIC DESCRIPTIVE STATISTICS

proc mean data=space_inventions;  

    var Year;

run;

OUTPUT:

The MEANS Procedure

Analysis Variable : Year
NMeanStd DevMinimumMaximum
121990.0820.15602021957.002015.00

/* Note: In practice above there is an Invalid in this code Find it,Correct it and Use it /*


YESTERDAY INVALID CODE ANSWER

11.Using PROC MEANS for Year Statistics - II

proc means data=space_inventions;

    var Year Usage;

run;

LOG:
69 proc means data=space_inventions;
70 var Year Usage;
ERROR: Variable Usage in list does not match type prescribed
for this list.
71 run;
NOTE: The SAS System stopped processing this step because
of errors.

Usage is a character variable.Proc Means Used For Only Descriptive Statistics.




To Visit My Previous Original Data Management Dataset:Click Here
To Visit My Previous Cricket World Cup Dataset:Click Here
To Visit My Previous Home Tour Dataset:Click Here
To Visit My Previous Real-World Dal Price Dataset:Click Here  



Follow Us On : 


 


--- FOLLOW OUR BLOG FOR MORE INFORMATION.

--->PLEASE DO COMMENTS AND SHARE OUR BLOG.









Comments

Popular posts from this blog

409.Can We Build a Reliable Emergency Services Analytics & Fraud Detection System in SAS While Identifying and Fixing Intentional Errors?

397.If a satellite has excellent signal strength but very high latency, can it still deliver good quality communication? Why or why not?A Sas Study

401.How Efficient Are Global Data Centers? A Complete SAS Analytics Study