SAS Rename

SAS Day 52

Once I use SAS proc import a Special Adverse Event dataset, everything looks good, except the variable name was directly from excel and has space and special characters like "/" (EOI/ Search)

Little Challenge: How to Rename a variable with space or special characters?

Basic Rename Syntax:

*1. within dataset
data a;
set a;
rename old_name=new_name;
run;

*2. on the first line;
data a(rename=old_name=new_name);
set a;
run;

Although this approach works majority of the time, it won't work with the special characters or there are spaces in the variable name.

Advanced Rename Syntax with Special Characters:

data a;
set a;
rename "old name"n= new_name;
run;

*example;

data sm;
set sm;
rename 'eoi/search strategy'n=eoi_search;
rename 'MedDRA Code'n=medra;
rename  'MedDRA PT'n=pt;
run;

Output:

image

Happy Studying!

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Pathname lookup in Linux. This write-up is based on three...
    朔飞阅读 4,151评论 0 0
  • NAME dnsmasq - A lightweight DHCP and caching DNS server....
    ximitc阅读 7,972评论 0 0
  • Piperade(番茄甜椒炒蛋),是法国巴斯克地区的一道传统家庭料理。常佐以肉类鱼类,口味清淡,适合做早餐或午餐。...
    逆向生活的邀请阅读 4,365评论 0 0
  • 1、写作背景 前面提到,当前的项目不是前后端分离,所有页面的跳转都是后端的页面跳转,这样做浏览器不能进行页面缓存,...
    糖纸疯了阅读 1,769评论 0 0
  • 昨天是妈妈的生日,我非常激动!因为妈妈过完生日,我马上就过生日了,我的生日是这周五。我就问妈妈爱吃什么呢?...
    8b78bb8a54f2阅读 832评论 0 0

友情链接更多精彩内容