Giter VIP home page Giter VIP logo

rogerjdeangelis / utl_merge_tables_with_same_colnames Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 5 KB

Allow users to add a suffix for column names in one of the tables. Keywords: sas sql join merge big data analytics macros oracle teradata mysql sas communities stackoverflow statistics artificial inteligence AI Python R Java Javascript WPS Matlab SPSS Scala Perl C C# Excel MS Access JSON graphics maps NLP natural language processing.

License: MIT License

SAS 100.00%

utl_merge_tables_with_same_colnames's Introduction

utl_merge_tables_with_same_colnames

SAS automatically, programtically rename colmns to avoid collisions. Allow users to add a suffix for column names in one of the tables. Join or merger tables and SAS datasets.

```  Merge two SAS tables with the same variable names  ```
```    ```
```  I still do not completely understand 'common storage' and  ```
```  multiple macro symbol tables, We need many examples from SAS.  ```
```  However this seems to work.  ```
```    ```
```  WORKING CODE  ```
```  ============  ```
```    ```
```    %varSfx(sashelp.class,sfx=_new);  ```
```    merge sashelp.class sashelp.class(rename=(&names));  ```
```    ```
```  HAVE  ```
```  ====  ```
```    ```
```    SASHELP.CLASS total obs=19  ```
```    ```
```    Obs    NAME       SEX    AGE    HEIGHT    WEIGHT  ```
```    ```
```      1    Alfred      M      14     69.0      112.5  ```
```      2    Alice       F      13     56.5       84.0  ```
```      3    Barbara     F      13     65.3       98.0  ```
```      4    Carol       F      14     62.8      102.5  ```
```      5    Henry       M      14     63.5      102.5  ```
```  ...  ```
```    ```
```  WANT  ```
```  ====  ```
```    ```
```  WORK.WANT total obs=19  ```
```    ```
```   NAME     SEX  AGE  HEIGHT  WEIGHT    NAME_NEW SEX_NEW AGE_NEW HEIGHT_NEW WEIGHT_NEW  ```
```    ```
```   Alfred    M    14   69.0    112.5    Alfred     M       14       69.0      112.5  ```
```   Alice     F    13   56.5     84.0    Alice      F       13       56.5       84.0  ```
```   Barbara   F    13   65.3     98.0    Barbara    F       13       65.3       98.0  ```
```   Carol     F    14   62.8    102.5    Carol      F       14       62.8      102.5  ```
```   Henry     M    14   63.5    102.5    Henry      M       14       63.5      102.5  ```
```    ```
```    ```
```  *                _               _       _  ```
```   _ __ ___   __ _| | _____     __| | __ _| |_ __ _  ```
```  | '_ ` _ \ / _` | |/ / _ \   / _` |/ _` | __/ _` |  ```
```  | | | | | | (_| |   <  __/  | (_| | (_| | || (_| |  ```
```  |_| |_| |_|\__,_|_|\_\___|   \__,_|\__,_|\__\__,_|  ```
```    ```
```  ;  ```
```    ```
```   Just use sashelp.class;  ```
```    ```
```    ```
```  *          _       _   _  ```
```   ___  ___ | |_   _| |_(_) ___  _ __  ```
```  / __|/ _ \| | | | | __| |/ _ \| '_ \  ```
```  \__ \ (_) | | |_| | |_| | (_) | | | |  ```
```  |___/\___/|_|\__,_|\__|_|\___/|_| |_|  ```
```    ```
```  ;  ```
```    ```
```    ```
```  proc datasets lib=work;  ```
```  delete twotbl;  ```
```  run;quit;  ```
```    ```
```  %symdel ds sfx names / nowarn;  ```
```    ```
```  %macro varSfx(ds,Sfx=);  ```
```     %symdel ds sfx names / nowarn;  ```
```     if _n_=0 then do;  ```
```      %let rc=%sysfunc(dosubl('  ```
```         %symdel ds sfx names / nowarn;  ```
```         proc transpose data=&ds(obs=1) out=__xpo(keep=_name_);  ```
```         var _all_;  ```
```         run;quit;  ```
```         proc sql;  ```
```            select cats(_name_,"=",_name_,"&sfx") into :names separated by " "  ```
```            from __xpo;  ```
```         ;quit;  ```
```      '));  ```
```      end;  ```
```  %mend varSfx;  ```
```    ```
```  %symdel ds sfx names; * not a bad idea because there can be two ds and sfx;  ```
```  data want;  ```
```    %varSfx(sashelp.class,sfx=_new);  ```
```    merge sashelp.class sashelp.class(rename=(&names));  ```
```  run;quit;  ```
```    ```

utl_merge_tables_with_same_colnames's People

Contributors

rogerjdeangelis avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.