如何从SAS中的一个包含长原始数据的变量中创建多个变量

huangapple go评论66阅读模式
英文:

How to create multiple variables from a variable with a long raw in SAS

问题

Here are the translations of the variable names and their corresponding responses:

  1. 设备宽度 (corresponds to response of "screenW":)
  2. 设备高度 (corresponds to response of "screenH":)
  3. 触摸 (corresponds to response of "touch":)
  4. 设备操作系统 (corresponds to response of "OS":)
英文:

I am having trouble creating multiple variables from one long row. See below example,

{"screenW":1098,"screenH":618,"touch":true,"OS":"Windows","UTCoffset":300}

I would like to create 4 variables using the above row:

  1. Device_width (corresponds to response of "screenW":)
  2. Device_height (corresponds to response of "screenH":)
  3. Touch (corresponds to response of "touch":)
  4. Device_OS (corresponds to response of "OS":)

Thank you!

答案1

得分: 3

JSON库引擎将解析JSON数据集。

示例:

filename mydata 'c:\temp\mydata.json';

data _null_;
  file mydata;
  put '{"screenW":1098,"screenH":618,"touch":true,"OS":"Windows","UTCoffset":300}';
run;

libname info json 'c:\temp\mydata.json';

proc copy inlib=info out=work;
run;
英文:

The JSON library engine will parse json into data sets.

Example:

filename mydata 'c:\temp\mydata.json';

data _null_;
  file mydata;
  put '{"screenW":1098,"screenH":618,"touch":true,"OS":"Windows","UTCoffset":300}';
run;

libname info json 'c:\temp\mydata.json';

proc copy inlib=info out=work;
run;

huangapple
  • 本文由 发表于 2023年5月25日 04:42:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76327273.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定