R : Convert Data from Wide to Long Format
This tutorial explains how to convert data from wide to long format with R programming.R Code : Convert Data from Wide to LongR Codemydata = read.table(text= "IDProduct1Product2Product3Product4...
View ArticleSplit a data frame
This tutorial explains how to split a data frame with R programming.Sample DataCreate Sample Datadata <- read.table(text="X Y Z ID12 2012-06 566 ID1...
View ArticleSingle, Double, Triple Ampersand SAS Macro Variables
This tutorial explains how single (&), double (&&) and Triple (&&&) ampersand macro variables are resolved.Example%let x=temp;%let n=3;%let x3=result;%let temp3 = result2; Check...
View ArticleR : Apply Function on Rows
This tutorial explains how to apply functions on rows.Sample Datadata = read.table(text="XYZ65063NA6158531NA 1872202", header=TRUE)Apply FunctionWhen we want to apply a function to the rows or columns...
View ArticleSAS : PROC RANK
This tutorial explains how to calculate rank for one or more numeric variables.Create Sample Datadata temp;input ID Gender $ Score;cards;1M332M943M664M465F926F957F188F11;run;Compute rank of numeric...
View ArticleReading large CSV File with R
This tutorial explains how to read large CSV files with R. I have tested this code upto 6 GB File.Read large CSV Files with RMethod I : Using data.table library library(data.table)yyy =...
View ArticleSAS : Reverse Order of Data
This tutorial explains how to reverse order of data in SAS.Reverse order of dataCreate Sample Datadata temp;input var1 @@;cards;2 9 6 4 3 8;run;Method I : With Sortingdata temp2;set temp;i =...
View ArticleSAS : Difference between SYMPUT and SYMGET
This tutorial explains the difference between SYMPUT and SYMPUT in SAS.Difference between SYMPUT and SYMGETSYMPUT : To create macro variables in a data step.SYMGET : To get macro variable value in a...
View ArticleSAS : Date Functions
This tutorial explains how to manipulate date values with SAS.System Dates (Current Date)data _null_;a = date();b = today();c = "&sysdate"d;put 'Without Format: ' a = b = c =;run; See Log Without...
View ArticleSAS : Calculating KS Test
In predictive modeling, it is very important to check whether the model is able to distinguish between events and non-events. There is a performance statistics called "Kolmogorov-Smirnov" (KS)...
View ArticleProc SQL Self Join Tutorial
This tutorial explains how to apply self join in SQL query.Example 1 : Find out ManagerSuppose you have data for employees. It comprises of employees' name, ID and manager ID. You need to find out...
View ArticleSAS : Convert wide to long format data
This tutorial explains how to reshape data by converting from wide format to long format.Create a sample data setdata temp;input ID time $ x1-x3;cards;1 Y1 85 85 861 Y2 80 79 701 Y3 78 77 872 Y1 79 79...
View ArticleWhy to use predictive modeling for Email Marketing
Today most e-mail marketers have started using predictive modeling to better target customers for particular products/services.. It is because predictive modeling in marketing activities can deliver...
View ArticleR : Summarize Data
This tutorial explains how to aggregate or summarize data.Create a sample dataset.seed(1)data <- data.frame(X = paste("s", sample(1:3, 15, replace = TRUE), sep = ""),Y = ceiling(rnorm(15)), Z =...
View ArticleCopy Data from Excel to R
This tutorial explains how to copy data from MS Excel to R.Copy Data from Excel to Rdata = read.table(text="X Y Z6 5 06 3 NA6 1 58 5 3", header=TRUE)It creates 3 columns - X, Y and Z. The header = TRUE...
View ArticleR : Create Dummy Data
This tutorial explains how to create dummy data.Create Dummy DataMethod 1 : Enter Data Manuallydf1 <- data.frame(ID = c(1, 2, 3, 4, 5), w = c('a', 'b', 'c', 'd', 'e'),...
View ArticleR : Character Functions
This tutorial lists some of useful character functions in R.Character Functions in R1. Convert objects into character valuesY = as.character(25)class(Y)2. Concatenate valuesx = "Deepanshu"y...
View ArticleCreate blank data frame with R
This tutorial explains how to create a blank data set (data frame) with R.R Programming : Create a blank data set dummydt=data.frame(matrix(ncol=0,nrow=0))Practical Application - It is very useful when...
View ArticleCreate Password Generator App with R
This tutorial explains how to create password generator utility with R.R : Password GeneratorR Function - Password GeneratorFeatures -Each password contains numeric, special character, lowercase letter...
View ArticleStoring Macro Variable Values to a Dataset
This tutorial explains how to store macro variable values to a data set.SAS Macro : Storing Macro Variable Values to a Dataset%macro storemacroval;proc sql noprint;select name into: nvar separated by...
View Article